2

I tried to run create-react-app myapp and everytime it throws an error

I tried to clean the cache by npm cache clean --force

but it didn't fix the problem

internal/modules/cjs/loader.js:638
throw err;
^

Error: Cannot find module './node'
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 Object.<anonymous> (D:\Design\react\myapp\node_modules\browserslist\index.js:8:11)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)

Aborting installation.
node  has failed.

My node version v10.17.0

My npm version 6.11.3

6
  • stackoverflow.com/a/52632987/1006272 have you tried this Commented Nov 14, 2019 at 23:13
  • @berniefitz yes i tried it didnt work. create-react-app deletes folder after it stops with error so npm i is useless Commented Nov 14, 2019 at 23:21
  • you try rm -rf node_modules and then npm install ? Commented Nov 15, 2019 at 2:06
  • @Chev after the error it deletes the folder. where should i run these commands Commented Nov 15, 2019 at 14:12
  • run those from the root of your project where you package.json is installed and your node_modules folder was. then try npm install again Commented Nov 15, 2019 at 17:42

4 Answers 4

2

I was presenting the same problem, until I realized that I had an instance of create-react-app installed globally, apparently this generates a kind of conflict, I solved it as follows:

  • Check the npm folder in the following path: C:/Users/username/AppData/Roaming/npm

I noticed that in this npm folder I had executable files of create-react-app. So I deleted all the npm folder and also uninstall node and reinstalled it and that solved my problem. I hope this is useful for you.

Sign up to request clarification or add additional context in comments.

Comments

1

This is because the create-react-app is not fully deleted from global packages, so to delete it completely goto 'C:\Users\YOUR_USERNAME\AppData\Roaming\npm' and delete the create-react-app.cmd file

Picture showing which file to delete

Comments

1

To show a list of globally installed packages:

npm -g list

To install create-react-app globally:

npm install -g create-react-app

I will use:

npx create-react-app [project-name] 

Comments

0

in my opinion you just install react app latest on your terminal dude. npx-create-app@latest . (.) react is installed in an existing folder. hoppely this my answer help to solve your problem

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.