问题
I have installed Grunt & Bower & I'm using ZSH.
when I type bower --help
or grunt anything
I get zsh: command not found: bower
or zsh: command not found: grunt
how can I fix this?
回答1:
Add /usr/local/share/npm/bin/
to your $PATH environment
回答2:
I couldn't get the above to work. Problem was that I had just reinstalled my Mac and forgotten to re-install grunt.
You can test that grunt is actually installed and working properly outside of zshell by going back to bash with bash -l
and running grunt
.
If grunt is throwing the same error you can install grunt by running:
sudo npm install -g grunt-cli
Run zsh
to get back to zshell.
回答3:
When you installed, did you install globally?
npm install -g bower
give that a try. If not, also try adding sudo
sudo npm install -g bower
回答4:
When you install grunt (bower), terminal tell you directory. For those using a ZSH shell, add this to .zshrc:
export PATH=/usr/you/directory/npm/bin:$PATH,
I find it using:
/lib/node_modules
export PATH=/usr/lib/node_modules/npm/bin:$PATH
回答5:
If you are using the GNOME-Terminal (default in Ubuntu Unity and Gnome) try the answer of https://askubuntu.com/questions/279180/nvm-command-not-found-issue.
来源:https://stackoverflow.com/questions/12555129/bower-grunt-zsh-command-not-found