-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
create-react-app fails due to node_modules being created in a wrong directory on Windows #3326
Comments
Try to clear your npm cache. |
I already did that and still does not work |
Can you try with some other npm version? e.g. maybe npm 5 |
@gaearon i tried with other versions of npm(included npm 5) and node and still got the same problem. |
i tried again with new versions of npm and nothing. Still same problem |
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 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. |
Unfortunately, we're ill-equipped to provide support for bugs like these. Make sure you actually cleared the npm cache by using I'm sorry we can't provide more assistance.
I'm not sure what you mean by this? |
i am doing |
I also cleared npm cache on npm 5.5.0 and still same issue. |
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 |
So @rostun cleaned cache in npm 5.5.1solved the problem for you? I didn't understand how do you solved this? Thanks |
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? |
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. |
well still doesn't work!! i tried with diferent versions of npm, cleaned cache and opened an issue in npm to try to solve the problem but i am not getting any answer. |
@rostun did you solved the problem?? |
Can you link to the npm issue you filed so we can track it? |
this is link of npm issue. |
OK, this might be our bug but I don’t know where it is. If you run
and then kill the process (e.g. with Ctrl+C) while it's running npm, can you describe the directory structure? Does |
The key evidence that something is wrong is here:
and
For two different people, |
It is also possible that we create
|
When i do |
So the |
Hmm, we don't set We change the working directory to the project folder here: @LeonelAV can you try editing your global CLI and explicitly setting |
Maybe some of |
In other words please add const child = spawn(command, args, { stdio: 'inherit', cwd: root }) |
@LeonelAV no unfortunately I wasn't able to figure it out :/ in the interest of time i had a buddy of mine create the repo for me and am just working off of that right now (create-react-app worked on his machine) |
I tried this but i'm still getting the same Error. Should i change something else or just this three lines? |
Anything unusual about shell? Are you using Cmd, PowerShell, GitBash, Cygwin, etc? |
I'm using Cmd. |
Can you keep the existing changes you made and also try putting process.chdir(root); before the |
@LeonelAV Is there any special significance to the |
What is the output of
on your machine? |
Is:
|
Do you remember setting this key? 😛 I thought I googled "how to change default terminal directory on windows" which led me to this answer with a scary "it can also really mess things up" disclaimer about the other answer. That link led me to this blog entry describing the problem: https://blogs.msdn.microsoft.com/oldnewthing/20071121-00/?p=24433/ (it's a good blog in general btw). Please run:
and then try creating an app again. |
It gives me:
|
Try again, I edited the comment (my syntax was wrong). |
@gaearon is working now.
Thanks a lot |
No, you can remove them. We'll try to figure out a better way to surface the cause of the problem though. |
Ok..Thank you |
@gaearon you just got way too familiar with Windows internals 😆 |
More than I care to know. |
I added a better warning for this in #3355. If you bump into this, the solution is described here: #3326 (comment) |
|
I was facing the same issue,
worked form me |
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 !!! |
This worked for me https://github.com/facebook/create-react-app/issues/138 |
F:\React-Lectures\Contact manger>npm install -g create-react-app 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, |
Is this a bug report?
yes
Can you also reproduce the problem with npm 4.x?
(Write your answer here.)
Which terms did you search for in User Guide?
(Write your answer here if relevant.)
Environment
node -v
: 6.10.2npm -v
:4.6.1yarn --version
(if you use Yarn):npm ls react-scripts
(if you haven’t ejected):Then, specify:
Steps to Reproduce
(Write your steps here:)
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.
The text was updated successfully, but these errors were encountered: