8

使用自制软件升级节点

==> 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

我注意到了这一点

==> 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

$PATH我已经:/usr/local/share/npm/lib/node_modules/scripted/bin 我也应该添加/usr/local/share/npm/bin吗?

请注意,/usr/local/share/npm/bin它只包含两个子文件夹:scr并且 scripted那也都在,那么这两个文件夹的用途/usr/local/share/npm/lib/node_modules/scripted/bin有什么区别?

EDIT /usr/local/share/npm/bin仅包含两个符号链接(不是子文件夹)

4

2 回答 2

6

也许您正在从旧版本的节点升级?我从 0.8.17 开始使用自制软件存储库中的节点,并且我的/usr/local/share/npm/bin. 它仅包含指向全局安装模块的可执行脚本的 simlink(在 中/usr/local/share/npm/lib/node_modules)。所以,我/usr/local/share/npm/bin在我的 $PATH 中,它工作正常。如果您是从旧版本的nodeand升级npm,请在更改 $PATH 之前尝试重新安装全局安装的模块。

于 2013-03-02T06:50:30.803 回答
0

打开终端并运行命令:

$ npm bin

在.zshrc / .bashrc / .profile中添加一行

export PATH="$PATH:/Users/USERNAME/node_modules/.bin"
于 2020-12-10T10:28:52.193 回答