I have git bash open and I type in npm install and then it returns:
bash: npm command not found
I don't understand, because I have node.js command prompt and when I type in npm -v then it returns 3.7.3. How come it doesn't work in git?
I have git bash open and I type in npm install and then it returns:
bash: npm command not found
I don't understand, because I have node.js command prompt and when I type in npm -v then it returns 3.7.3. How come it doesn't work in git?
If you are on Windows, try this: In CMD, go to folder
C:\Program Files or (x86)\nodejs\
Then try the following
C:\Program Files\nodejs>set path=%PATH%;%CD%
C:\Program Files\nodejs>setx path "%PATH%"
It works for me!
If you installed git bash first and then node.js, uninstall gitbash and keep node.js. And then re-install git bash again.
npm --version
node --version
check version using this command
Assuming you are on Windows trying git-bash, and node was installed by Visual Studio: The cause may be a missing npm bash script.
There is an npm.cmd bath file in the path:
C:\Program Files (x86)\Microsoft Visual Studio 14.0\Web\External\npm.cmd
But git bash wont run .cmd files. So you need to create a bash script for npm.
Create the following file named npm in your node folder: (C:\Program Files (x86)\Microsoft Visual Studio 14.0\Web\External\)
#!/bin/sh
basedir=`dirname "$0"`
case `uname` in
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
esac
if [ -x "$basedir/node" ]; then
"$basedir/node" "$basedir/node_modules/npm/bin/npm-cli.js" "$@"
ret=$?
else
node "$basedir/node_modules/npm/bin/npm-cli.js" "$@"
ret=$?
fi
exit $ret
if you have installed node / npm in a drive other than the os drive you will need to node and npm to the path environment variable (windows) right click on this pc go to advanced system settings -> environment variables -> double click on path and add
Drive:\nodejs\node_modules\npm\bin
Drive:\nodejs
click ok and close the opened cli and open it again to check in cli run :
echo "$PATH"
I had to add node path to system variable AND reboot. For some reason closing and reopening git bash was not enough
I know this post is old but this could help someone who installed Node / npm via Visual Studio Installer. I tried every solution I could find online but none works until I did the following:
Uninstall Node using Visual Studio Installer.
Install it using installer downloaded from the Node.js site. Use default options.
This option is work for me.
above mention ----
Uninstall Node using Visual Studio Installer.
Install it using installer downloaded from the Node.js site. Use default options.
Pretty old thread, but if anyone needs this :
As suggested by @fernandosavio, I restarted my IDE(IntelliJ in my case) in order for it to load the new $PATH, and it worked like a charm.
Note: Just closing and opening the in-house terminal of the IDE won't do the trick.
In my case I have also faced this problem, so I found a solution.
• just go to programs and features of your control panel and search for Node...
• then just repair node. it worked fine for me