skip to Main Content

I am using Node.js v19.4.0.

When I run npx create-react-app MyApp to create react project
in visual studio code editor I get the following error:

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

Error: Cannot find module 'C:Program Filesnodejsnode_modulesnpmbinnode_modulesnpmbinnpm-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 Filesnodejsnode_modulesnpmbinnode_modulesnpmbinnpx-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: []
}

4

Answers


  1. the first solution is to uninstall the node.js and npm and then reinstall them.
    or it might be because of an incorrect node_modules path. please check the path and make sure it is correct.

    Login or Signup to reply.
  2. First, try to clear npm cache:

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

    If the above solution will not work then, try to remove node.js and then re-install.

    Hope this helps!

    Login or Signup to reply.
  3. Downgrade to a lts supported version!

    brew install node@18

    brew link --overwrite node@18

    node --version

    worked for me. (Macbook M1; Ventura 13.1.)

    Login or Signup to reply.
  4. In my case I had to npm install the missing "modules" with was "npm install validator" and "npm install is-empty. The required stack pointed in the direction….took all of yesterday to figure it out.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search