reactjsnode-modules

i accidently deleted some my node modules file while first time creating react app by terminal


Node.js v18.12.1
PS D:\CS\0. Code\github> npx create-react-app .
node:internal/modules/cjs/loader:998
  throw err;
  ^

Error: Cannot find module '../remove'
Require stack:
- C:\Users\HP\AppData\Local\npm-cache\_npx\c67e74de0542c87c\node_modules\fs-extra\lib\empty\index.js       
- C:\Users\HP\AppData\Local\npm-cache\_npx\c67e74de0542c87c\node_modules\fs-extra\lib\index.js
- C:\Users\HP\AppData\Local\npm-cache\_npx\c67e74de0542c87c\node_modules\create-react-app\createReactApp.js
- C:\Users\HP\AppData\Local\npm-cache\_npx\c67e74de0542c87c\node_modules\create-react-app\index.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:995:15)
    at Module._load (node:internal/modules/cjs/loader:841:27)
    at Module.require (node:internal/modules/cjs/loader:1061:19)
    at require (node:internal/modules/cjs/helpers:103:18)
    at Object.<anonymous> (C:\Users\HP\AppData\Local\npm-cache\_npx\c67e74de0542c87c\node_modules\fs-extra\lib\empty\index.js:7:16)
    at Module._compile (node:internal/modules/cjs/loader:1159:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1213:10)
    at Module.load (node:internal/modules/cjs/loader:1037:32)
    at Module._load (node:internal/modules/cjs/loader:878:12)
    at Module.require (node:internal/modules/cjs/loader:1061:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    'C:\\Users\\HP\\AppData\\Local\\npm-cache\\_npx\\c67e74de0542c87c\\node_modules\\fs-extra\\lib\\empty\\index.js',
    'C:\\Users\\HP\\AppData\\Local\\npm-cache\\_npx\\c67e74de0542c87c\\node_modules\\fs-extra\\lib\\index.js',
    'C:\\Users\\HP\\AppData\\Local\\npm-cache\\_npx\\c67e74de0542c87c\\node_modules\\create-react-app\\createReactApp.js',
    'C:\\Users\\HP\\AppData\\Local\\npm-cache\\_npx\\c67e74de0542c87c\\node_modules\\create-react-app\\index.js'
  ]
}

while i was first time creating react app, my internet connection broke at middle. so i deleted some install file, when i was creating it second time, terminal give me this error.

i tryed npm install to reinstal module but its not gime me proper solution currently i have this four file in my working folder

  1. node_modules
  2. index.html
  3. package-lock.json
  4. pacakage.json

plz help me to resolve this issue


Solution

  • Some different way I mention here:

    Way 1. if you are creating a new project then delete the older project, and also delete it from recycle bin. Now create a new application again.

    Way 2. Again the same problem occurs then follow 1st way and then clear your temp file and then try to create a new application.

    temp clear steps for windows OS. press ctr + R for open cmd.

    1 -> type "temp" and delete all files,

    2 -> type "%temp%" and delete all files,

    3 -> type "prefetch" and delete all files

    Way 3. Reinstall npm.