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
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.
First, try to clear npm cache:
npm install
npm start
If the above solution will not work then, try to remove node.js and then re-install.
Hope this helps!
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.)
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.