Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I seem to be getting the following when I execute npm install bower -g

/usr/local/share/npm/bin/bower -> /usr/local/share/npm/lib/node_modules/bower/bin/bower
bower@0.8.6 /usr/local/share/npm/lib/node_modules/bower

Unfortunately executing any of the bower commands returns -bash: bower: command not found

which npm returns /usr/local/bin/npm and running which node returns /usr/local/bin/node.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
424 views
Welcome To Ask or Share your Answers For Others

1 Answer

I assume you installed Node.js through Homebrew, which annoyingly puts installed npm binaries in a place that is usually not in a users path. All you have to do is to add /usr/local/share/npm/bin to your $PATH. You do that by adding export PATH=/usr/local/share/npm/bin:$PATH to your .bashrc/.bash_profile/.zshrc file.

Although I would rather uninstall the Homebrew installed Node.js and install it with the installer from nodejs.org which doesn't have this problem.

This problem is not Bower specific and will be noticeable with any globally installed Node.js binary, eg. grunt, uglify, jshint, etc.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share

548k questions

547k answers

4 comments

86.3k users

...