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

编程入门 行业动态 更新时间:2024-10-25 04:20:56
本文介绍了如何添加npm(node.js包管理器)到PATH?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我安装了node.js:

cd / usr / local / bin / git clone - -depth 1 github/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 npmjs/install.sh | sh 以安装npm。退出并重新登录后,无法识别npm命令:

[/ usr / local / bin / node] #npm install now -bash:npm:command not found

$ p <$ p

$ p> git clone github/npm/npm.git cd npm sudo make install

此建议来自 https:// github/isaacs/npm#readme 。

它不像curl | sh一样可爱,但可以工作。

I installed node.js like this:

cd /usr/local/bin/ git clone --depth 1 github/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 npmjs/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 github/npm/npm.git cd npm sudo make install

That advice comes from of github/isaacs/npm#readme.

It is not as cute as curl|sh, but works.

更多推荐

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

本文发布于:2023-05-31 10:04:42,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/389541.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:管理器   node   npm   PATH   js

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!