-
-
Notifications
You must be signed in to change notification settings - Fork 27k
Running create-react-app on Windows: Error: Cannot find module package.json #1905
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
Comments
This is weird. Can you try installing Yarn and then running Create React App again? I don't understand why npm acts weird, but maybe Yarn doesn't suffer from the same issue. |
Still no go there. I globally uninstalled create-react-app and react-scripts using npm. Verified Although, now that yarn is installed, isn't create-react-app supposed to be using that? I don't see a yarn.lock file get created. And it looks like it is still using npm:
|
Yes, it should be using yarn when available. |
Also, what is |
.npmrc does not exist. I deleted it yesterday. It existed for a brief moment while I was trying to debug this issue, it had To test yarn further I removed npm from the path, and create-react-app errors like this:
|
Seems like you have your PATH setup incorrectly -- you shouldn't be touching it manually. |
Oops. Looks like this was all my fault. I have a script setup in the registry to run on new command prompts. I use it like a .bash_profile to setup aliases and such. But... for whatever reason, I had this line in my script: So I'll assume that |
Sounds good! Happy you got it resolved. |
This is interesting, thank you for sharing the solution. |
Description
I've installed
create-react-app
and have been trying to create new apps, but it never succeeds.Expected behavior
Creates the app.
Actual behavior
See the log below, running
create-react-app asdf
fails with this message:Error: Cannot find module 'C:\temp\asdf\node_modules\react-scripts\package.json
Also, I see this warning message where
C:\Users\thatodieguy
is my Windows home folder. And running thecreate-react-app
script creates a node_modules in my windows home folder. This seems rather odd.npm WARN saveError ENOENT: no such file or directory, open 'C:\Users\thatodieguy\package.json'
I've tried the following:
npm cache clean
,create-react-app
is running, copying the node-modules from my home folder into the C:\temp\asdf folder.. this gets us a little further. But then I get the error messageMissing dependencies in package.json
create-react-app --scripts-version 0.8.2 asdf
It seems to me that the script is using my Windows home folder as the project root for some reason.
Environment
Run these commands in the project folder and fill in their results:
npm ls react-scripts
(if you haven’t ejected): react-scripts@0.9.5node -v
: v6.10.1npm -v
: 4.5.0Log
The text was updated successfully, but these errors were encountered: