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 [email protected] 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.
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!
@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!
Most helpful comment
1- Install
yarnif you don't have it:npm i yarn -g2- Run this command in your project directory:
yarnIt should get solved!