I faced this problem where it says 'node' is not recognized as an internal or external command, operable program or batch file. when i try to execute npm start from git bash cli.
$ npm start
> [email protected] start C:\Users\Admin\Desktop\react\project
> react-scripts start
'node' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Admin\AppData\Roaming\npm-cache\_logs\2018-05-16T01_35_47_855Z-debug.log
However, if i execute node -v or npm -v from git bash, it returns me result
Derek MINGW64 ~/Desktop/react/project (master)
$ npm -v
5.6.0
Derek MINGW64 ~/Desktop/react/project (master)
$ node -v
v9.5.0
And if i execute the same thing from windows cmd, it works:
Compiled successfully!
You can now view project in the browser.
Local: http://localhost:3000/
On Your Network: http://192.168.10.1:3000/
Note that the development build is not optimized.
To create a production build, use npm run build.
UPDATE:
Added node and npm into environment variable
I'd been searching for the answer to this and all I got was 'add nodejs to the path', which I had already done (and actually is done by node on installation) Finally discovered that git bash is sensitive to spaces in the PATH variable.
So... the safest way is to add a slash after the path variable so you are sure that there is no space after "\nodejs" part, i.e.
C:\Program Files\nodejs\
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With