I'm using msysgit on Windows, whenever I install something ie Node.js or a package via NPM I always get command not found until the system is rebooted. Even closing git bash and reopening I have the same issue. I've set environment paths for npm and node:
C:\Ruby200\bin;C:\Python27;C:\Program Files\nodejs;C:\Users\Predator\AppData\Roaming\npm
Edit:
For example using Git Bash window I have Node.Js and NPM installed. I want to install a package globally so run:
npm install grunt -g
Grunt then installs globally, I then check grunt is installed by running
grunt --version
Error produced is:
sh: grunt: command not found
This happens with all NPM packages, it even happened with node.js and npm when I installed them. How can I restart Git Bash to take into account the newly installed packages?
To add say C:\\Program Files\\nodejs
to the path inside the shell, you would issue:
PATH="C:/Program\ Files/nodejs;$PATH"
export PATH
in some shells you can combine those two commands in one:
export PATH="C:/Program\ Files/nodejs;$PATH"
to look to see what folders are currently searched:
echo $PATH
You may be able to get the shell to reread the environment giving the -l
option when you run the shell. See what your shell is by running:
echo $SHELL
If you get something, then try running:
$SHELL -l
which starts another login shell. However better is to use:
exec $SHELL -l
which starts a new shell replacing the old one. Without "exec" you'll have the new shell nested inside the old one, which might not be so bad.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.