Quick Summary
This is not a duplicate of the linked question, the issue there was a typo, this isn't isn't a typo.
I can run node
in my bash terminal fine. If I try and run node
inside an NPM script in that same bash terminal, then I get the error 'node' is not recognized as an internal or external command
Original Question
I'm having issues running npm install
in one of my projects currently, but to be able to simplify all of the moving parts, I've created an NPM script in my package.json
file, simply calling node nodetest.js
.
The content of nodetest.js
is as follows:
console.log('Node Test Success!');
On the command line, I can call node nodetest.js
, and it will output the console log as expected.
If I call npm run nodetest
, I get the error saying 'node' is not recognized as an internal or external command
Inside the same command line, I have access to node
(/c/Program Files/nodejs/node
), npm
(/c/Program Files/nodejs/npm
), and even npx
(/c/Program Files/nodejs/npx
)
Node is set in my PATH variable, and I've even added it to .bashrc
.
What else could possibly be the problem?
Edit: I neglected to detail my system
- Windows 10
- Using Git Bash inside ConEmu
- Node version 10.1.0
- NPM version 6.0.0
Edit 2: Some further curiosities
If I change my NPM script to be "nodetest": "\"/c/Program Files/nodejs/node.exe\" nodetest.js"
, and then run npm run nodetest
, I get an error in the output:
> "/c/Program Files/nodejs/node.exe" nodetest.js
The system cannot find the path specified.
BUT, if I copy that command exactly, and run it directly on the command line, it will work perfectly!