when I try to create a react project with both npm and yarn, it shows me the following error:
I tried to reinstall node and make sure it was up to date, as well as create-react-app by running npm install -g create-react-app@latest. I also removed the npm and npm-cache folders and the environment variable, but nothing works for me and I keep getting the same error.
internal/modules/cjs/loader.js:638
throw err;
^
Error: Cannot find module 'react-scripts/scripts/init.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
at Function.Module._load (internal/modules/cjs/loader.js:562:25)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at [eval]:2:20
at Script.runInThisContext (vm.js:122:20)
at Object.runInThisContext (vm.js:329:38)
at Object.<anonymous> ([eval]-wrapper:6:22)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at evalScript (internal/bootstrap/node.js:589:27)
Aborting installation.
node has failed.
Deleting generated file... node_modules
Deleting generated file... package.json
Deleting generated file... yarn.lock
Deleting test/ from C:\Users\Esper\projects
Done.
I think the problem arose from restoring my windows 10 to a previous state due to operating system problems, because before restoring it, when I run create-react-app it worked correctly.
create-react-app --version 3.1.1
node -v v10.16.3
npm -v 6.9.0
SO Windows 10 Education
npx create-react-app your-app?npx create-react-app your-apporcreate-react-app your-appworksnpm uninstall create-react-appbefore re-installing it ?