如何添加npm(node.js包管理器)到PATH? [英] How can I add npm (node.js package manager) to the PATH?
本文介绍了如何添加npm(node.js包管理器)到PATH?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我安装了node.js:
cd / usr / local / bin /
git clone - -depth 1 http://github.com/joyent/node.git
cd node
git checkout origin / v0.4#optional。请注意,主站不稳定。
export JOBS = 2#可选,设置并行命令数。
mkdir〜/ local
./configure --prefix = $ HOME / local / node
make
make install
echo'export PATH = $ HOME / local / node / bin:$ PATH'>> 〜/ .profile
source〜/ .profile
c> curl http://npmjs.org/install.sh | sh 以安装npm。退出并重新登录后,无法识别npm命令:
[/ usr / local / bin / node] #npm install now
-bash:npm:command not found
$ p
<$ p $ p>
git clone https://github.com/npm/npm.git
cd npm
sudo make install
此建议来自 https:// github.com/isaacs/npm#readme 。
它不像curl | sh一样可爱,但可以工作。
I installed node.js like this:
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
Then I executed this curl http://npmjs.org/install.sh | sh
to install npm. After I logged out and logged back in, npm command wasn't recognized:
[/usr/local/bin/node]# npm install now
-bash: npm: command not found
What should I add to the PATH to have npm working?
解决方案
Try this:
git clone https://github.com/npm/npm.git
cd npm
sudo make install
That advice comes from of https://github.com/isaacs/npm#readme.
It is not as cute as curl|sh, but works.
这篇关于如何添加npm(node.js包管理器)到PATH?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文