Which npm/bin folder(s) should be in the PATH ? ( OS X 10.8.2 / npm installed with homebrew )

Upgrading node by using homebrew

==> Downloading http://nodejs.org/dist/v0.8.21/node-v0.8.21.tar.gz
######################################################################## 100.0%
==> ./configure --prefix=/usr/local/Cellar/node/0.8.21
==> make install

I’m noticed this

==> Caveats
Homebrew installed npm.
We recommend prepending the following path to your PATH environment
variable to have npm-installed binaries picked up:
  /usr/local/share/npm/bin

In the $PATH I had already: /usr/local/share/npm/lib/node_modules/scripted/bin
Should I add /usr/local/share/npm/bin too?

Please note that /usr/local/share/npm/bin only contains two subfolder: scr and scripted that are also in /usr/local/share/npm/lib/node_modules/scripted/bin so what’s the difference in the purpose of these two folders?

EDIT
/usr/local/share/npm/bin only contains two symlinks ( not subfolders )

Here is Solutions:

We have many solutions to this problem, But we recommend you to use the first solution because it is tested & true solution that will 100% work for you.

Solution 1

Maybe you are upgrading from old version fo node? I’m using node from homebrew repository since 0.8.17 and i don’t have any subfolders in my /usr/local/share/npm/bin. It contains only simlinks to executable scripts of globally installed modules (in /usr/local/share/npm/lib/node_modules). So, i have /usr/local/share/npm/bin in my $PATH and it works fine.
If you are upgrading from old version of node and npm, try to reinstall your globally installed modules before changing your $PATH.

Solution 2

Open terminal and run command:

$ npm bin

Add line in .zshrc / .bashrc / .profile

export PATH="$PATH:/Users/USERNAME/node_modules/.bin"

Note: Use and implement solution 1 because this method fully tested our system.
Thank you 🙂

All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply