如何将npm(node.js包管理器)添加到PATH?

emu*_*rad 9 centos cpanel whm node.js

我像这样安装了node.js:

cd /usr/local/bin/
git clone --depth 1 http://github.com/joyent/node.git
cd node
git checkout origin/v0.4 # optional.  Note that master is unstable.
export JOBS=2 # optional, sets number of parallel commands.
mkdir ~/local
./configure --prefix=$HOME/local/node
make
make install
echo 'export PATH=$HOME/local/node/bin:$PATH' >> ~/.profile
source ~/.profile
Run Code Online (Sandbox Code Playgroud)

然后我执行了这个curl http://npmjs.org/install.sh | sh来安装npm.我退出并重新登录后,无法识别npm命令:

[/usr/local/bin/node]# npm install now
-bash: npm: command not found
Run Code Online (Sandbox Code Playgroud)

我应该在PATH中添加什么才能让npm正常工作?

Tha*_*Tyl 17

试试这个:

git clone https://github.com/npm/cli
cd npm/cli
sudo make install
Run Code Online (Sandbox Code Playgroud)

该建议来自https://github.com/isaacs/npm#readme.

它不像curl | sh那么可爱,但是有效.

  • 除了`rm -rf /`圣诞节做什么? (2认同)