Milad Dehghan
Milad Dehghan

Reputation: 306

create react app error Cannot find module './node'

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

Upvotes: 2

Views: 4276

Answers (4)

Ana Williams
Ana Williams

Reputation: 11

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] 

Upvotes: 1

M Naufal Helmi
M Naufal Helmi

Reputation: 107

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

Upvotes: 0

Shahzaib Mughal
Shahzaib Mughal

Reputation: 11

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

Upvotes: 1

Leonardo Ramos
Leonardo Ramos

Reputation: 21

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.

Upvotes: 2

Related Questions