Which npm/bin folder(s) should be in the PATH ? (

2019-04-07 20:08发布

问题:

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 )

回答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.