You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
create-react-app fails due to node_modules being created in a wrong directory on Windows #3326
starts to install react, react-dom and react-scripts and before finish i get an error: Aborting Instalation
Aborting installation.
Unexpected error. Please report it as a bug:
{ Error: Cannot find module 'C:\Users\leonel\Desktop\pseudogram\node_modules\react-
scripts\package.json'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at checkNodeVersion (C:\Users\leonel\AppData\Roaming\npm\node_modules\create-re
act-app\createReactApp.js:476:23)
at getPackageName.then.then.then.packageName (C:\Users\leonel\AppData\Roaming\n
pm\node_modules\create-react-app\createReactApp.js:283:7)
at process._tickCallback (internal/process/next_tick.js:109:7) code: 'MODULE_NO
T_FOUND' }
Deleting generated file... package.json
Deleting pseudogram / from C:\Users\leonel\Desktop
Done.
Expected Behavior
I expect it create the folder project
Actual Behavior
Aborting installation.
Unexpected error. Please report it as a bug:
{ Error: Cannot find module 'C:\Users\leonel\Desktop\pseudogram\node_modules\react-
scripts\package.json'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at checkNodeVersion (C:\Users\leonel\AppData\Roaming\npm\node_modules\create-re
act-app\createReactApp.js:476:23)
at getPackageName.then.then.then.packageName (C:\Users\leonel\AppData\Roaming\n
pm\node_modules\create-react-app\createReactApp.js:283:7)
at process._tickCallback (internal/process/next_tick.js:109:7) code: 'MODULE_NO
T_FOUND' }
Deleting generated file... package.json
Deleting pseudogram / from C:\Users\leonel\Desktop
Done.
I realize that the node_modules folder is created in another folder and not in the folder of the project, thats why it can´t found the module i guess... how can i solve this? @Timer@gaearon
Unfortunately, we're ill-equipped to provide support for bugs like these.
Make sure you actually cleared the npm cache by using --force on npm >=5.
If that doesn't help, you'll need to open an issue with npm -- this is a bug with their package manager.
I'm sorry we can't provide more assistance.
I realize that the node_modules folder is created in another folder and not in the folder of the project
i am doing create-react-app command in Desktop folder : C:\Users\leonel\Desktop: create-react-app my-app
and the nodules_modules folder is not created in my-app folder, instead is created in antoher folder that i have, called Projects.
I'm getting the same error as op (on windows 10, npm 5.5.1, and tried force clearing npm cache) :
While investigating, i also noticed that node_modules folder is "missing" because its being created at C:\node_modules and not " C:\test\my-app\node_modules as you can see below:
I tried this about a month ago (on windows 10) and it worked
We've been testing Windows in the past releases, and 2 days ago was the first time anyone brought it up. We haven't made a release in that timeframe. This is why I think it's some other update that's causing the issue.
If Windows support was broken for everyone we'd have known it a long time ago.
My admin made my default Windows username "first lastname" and so, the c:\Users\first lastname\AppData... has a space in the path and causes headaches with npm, etc. I tried creating a new user with just my first name (no spaces) and everything installs fine.
Hey! I was just having the same issue as above node modules not found while i was using git bash terminal than i switched to nodejs terminal and surprisingly it work no more showing node_modules not found !!!
So i would suggest to try this way around for a while until they find solution!!!1
This worked for me https://github.com/facebook/create-react-app/issues/138
Run.
$ npm config set prefix /usr/local
And then reinstall react.
$ npm install -g create-react-app
The command should work now.
$ create-react-app my-app
F:\React-Lectures\Contact manger>npm install -g create-react-app
'npm' is not recognized as an internal or external command,
operable program or batch file.
when i use this command on general cmd it is workin but when i came to folder after install npm globally write the command create-react-app my-app this error is occured 'npm' is not recognized as an internal or external command,
operable program or batch file.
Activity
Timer commentedon Oct 25, 2017
Try to clear your npm cache.
LeonelAV commentedon Oct 25, 2017
I already did that and still does not work
gaearon commentedon Oct 25, 2017
Can you try with some other npm version? e.g. maybe npm 5
LeonelAV commentedon Oct 25, 2017
@gaearon i tried with other versions of npm(included npm 5) and node and still got the same problem.
LeonelAV commentedon Oct 25, 2017
i tried again with new versions of npm and nothing. Still same problem
LeonelAV commentedon Oct 26, 2017
I realize that the node_modules folder is created in another folder and not in the folder of the project, thats why it can´t found the module i guess... how can i solve this? @Timer @gaearon
davidr9 commentedon Oct 26, 2017
I am experiencing the exact same issue. I also noticed the node_modules folder is created outside the project in question, directly in my C drive.
npm version: 3.10.10
node version: 6.9.5
OS: Windows 7
My friend attempted to replicate the issue using the exact same steps on a Mac, but the app was created as expected for him.
Timer commentedon Oct 27, 2017
Unfortunately, we're ill-equipped to provide support for bugs like these.
Make sure you actually cleared the npm cache by using
--forceon npm >=5.If that doesn't help, you'll need to open an issue with npm -- this is a bug with their package manager.
I'm sorry we can't provide more assistance.
I'm not sure what you mean by this?
LeonelAV commentedon Oct 27, 2017
I'm not sure what you mean by this?i am doing
create-react-appcommand in Desktop folder :C:\Users\leonel\Desktop: create-react-app my-appand the
nodules_modulesfolder is not created in my-app folder, instead is created in antoher folder that i have, called Projects.LeonelAV commentedon Oct 27, 2017
I also cleared npm cache on npm 5.5.0 and still same issue.
rostun commentedon Oct 27, 2017
I'm getting the same error as op (on windows 10, npm 5.5.1, and tried force clearing npm cache) :
While investigating, i also noticed that node_modules folder is "missing" because its being created at C:\node_modules and not " C:\test\my-app\node_modules as you can see below:
I tried this about a month ago (on windows 10) and it worked
LeonelAV commentedon Oct 27, 2017
So @rostun cleaned cache in npm 5.5.1solved the problem for you? I didn't understand how do you solved this? Thanks
gaearon commentedon Oct 27, 2017
Since the issue is very recent and symptoms are similar, there has to be something that updated recently causing this.
Is there anything in common between your systems?
rostun commentedon Oct 27, 2017
@gaearon with what @davidr9 mentioned, maybe its a windows only issue
since node_modules isn't being copied into the right path, maybe something changed with the way the path for that is determined
gaearon commentedon Oct 27, 2017
We've been testing Windows in the past releases, and 2 days ago was the first time anyone brought it up. We haven't made a release in that timeframe. This is why I think it's some other update that's causing the issue.
If Windows support was broken for everyone we'd have known it a long time ago.
26 remaining items
LeonelAV commentedon Oct 30, 2017
@gaearon is working now.
Thanks a lot
gaearon commentedon Oct 30, 2017
No, you can remove them. We'll try to figure out a better way to surface the cause of the problem though.
LeonelAV commentedon Oct 30, 2017
Ok..Thank you
Timer commentedon Oct 30, 2017
@gaearon you just got way too familiar with Windows internals 😆
gaearon commentedon Oct 30, 2017
More than I care to know.
gaearon commentedon Oct 30, 2017
#3355
gaearon commentedon Oct 30, 2017
I added a better warning for this in #3355.
If you bump into this, the solution is described here: #3326 (comment)
gaearon commentedon Oct 30, 2017
create-react-app@1.4.2should now emit a readable error in this case.ManojKSingh commentedon Apr 19, 2018
I was facing the same issue,
worked form me
chadsteele commentedon Jul 29, 2018
My admin made my default Windows username "first lastname" and so, the c:\Users\first lastname\AppData... has a space in the path and causes headaches with npm, etc. I tried creating a new user with just my first name (no spaces) and everything installs fine.
sudipt1999 commentedon Sep 6, 2018
Hey! I was just having the same issue as above node modules not found while i was using git bash terminal than i switched to nodejs terminal and surprisingly it work no more showing node_modules not found !!!
So i would suggest to try this way around for a while until they find solution!!!1
tgifgirltechlaunch commentedon Oct 10, 2018
This worked for me https://github.com/facebook/create-react-app/issues/138
Run.
$ npm config set prefix /usr/local
And then reinstall react.
$ npm install -g create-react-app
The command should work now.
$ create-react-app my-app
Arshaq1996 commentedon Jan 3, 2019
F:\React-Lectures\Contact manger>npm install -g create-react-app
'npm' is not recognized as an internal or external command,
operable program or batch file.
when i use this command on general cmd it is workin but when i came to folder after install npm globally write the command create-react-app my-app this error is occured 'npm' is not recognized as an internal or external command,
operable program or batch file.