Skip to content
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

'npm' is not recognized as an internal or external command, operable program or batch file. #3861

Closed
drew0530 opened this issue Jan 18, 2018 · 2 comments

Comments

@drew0530
Copy link

Current Behavior:

$ create-react-app my-app

Creating a new React app in C:\Users\SwoleDaddyBuffNeck\my-app.

'npm' is not recognized as an internal or external command,
operable program or batch file.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts...

'npm' is not recognized as an internal or external command,
operable program or batch file.

Aborting installation.
  npm install --save --save-exact --loglevel error react react-dom react-scripts@0.9.x has failed.

I have tried everything under the sun, including uninstalling and reinstalling node, npm, and the create-react-app package, switching to a different version, and every variation of how to add npm to my PATH I could find on the internet. I dont usually have issues with npm, and I use it for several other projects, and it seems to work fine, I cannot figure out why it's only happening here. I could actually install react and react-dom manually, but when I tried installing react-scripts, it didnt output anything and I had to ctrl+c to get my console back.

I understand this is not a forum for npm, but as I described, I dont have this issue in other projects, and it works fine doing literally anything else. Any help would be greatly appreciated.

@ehsankhfr
Copy link
Contributor

1- Install yarn if you don't have it: npm i yarn -g
2- Run this command in your project directory: yarn

It should get solved!

@JimmayVV
Copy link

JimmayVV commented Mar 20, 2018

@ehsankhfr thanks for this! This worked like a charm for me. I was really struggling to sort out the same issue.

While OP didn't mention the environment they were using, just for reference I am using a portable dev setup - I have VS Code running an instance of git-bash as its terminal on Windows.

I know using a portable dev environment isn't ideal, but for my purposes it's the only practical solution aside from using remote virtual machines across the internet.

And using Windows complicates the npm/node/npx/git dynamic since I have to update npm & node manually.

So installing yarn was the perfect solution. Even the npm v < 5.1 instructions didn't help, as it ran into the same error message.

I hope others with this issue find this question. Thanks again!

@Timer Timer closed this as completed Mar 26, 2018
@lock lock bot locked and limited conversation to collaborators Jan 20, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants