Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error "node:internal/modules/cjs/loader:1056 throw err;"

I am using Node.js v19.4.0.

When I run npx create-react-app MyApp to create a React project in the Visual Studio Code editor, I get the following error:

node:internal/modules/cjs/loader:1056
  throw err;
  ^

Error: Cannot find module 'C:\Program Files\nodejs\node_modules\npm\bin\node_modules\npm\bin\npm-cli.js'
    at Module._resolveFilename (node:internal/modules/cjs/loader:1053:15)
    at Module._load (node:internal/modules/cjs/loader:898:27)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:84:12)
    at node:internal/main/run_main_module:23:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

Node.js v19.4.0
node:internal/modules/cjs/loader:1056
  throw err;
  ^

Error: Cannot find module 'C:\Program Files\nodejs\node_modules\npm\bin\node_modules\npm\bin\npx-cli.js'
    at Module._resolveFilename (node:internal/modules/cjs/loader:1053:15)
    at Module._load (node:internal/modules/cjs/loader:898:27)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:84:12)
    at node:internal/main/run_main_module:23:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}
like image 714
Bader Juma Avatar asked Sep 08 '25 16:09

Bader Juma


1 Answers

First, try to clear the npm cache with:

npm cache clean --force
  • then remove all node_modules folders from the application
  • remove the package-lock.json file from the application
  • Install packages again by using the command npm install
  • then start the application using npm start

If the above solution will not work then, try to remove Node.js and then reinstall.

like image 70
Parth Raval Avatar answered Sep 10 '25 06:09

Parth Raval