在没有sudo的情况下安装npm

时间:2015-02-09 09:41:30

标签: node.js install npm sudo

我必须在没有root权限的计算机上安装npm,由于缺少依赖项,我会遇到一些错误。我附上了屏幕。任何的想法?感谢。

enter image description here

enter image description here enter image description here

2 个答案:

答案 0 :(得分:2)

来自isaacs,node.js的贡献者之一:

   echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
    . ~/.bashrc
    mkdir ~/local
    mkdir ~/node-latest-install
    cd ~/node-latest-install
    curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
    ./configure --prefix=~/local
    make install
    curl https://www.npmjs.org/install.sh | sh

了解更多信息: https://gist.github.com/isaacs/579814

答案 1 :(得分:0)

Fancy Install(Unix)

https://www.npmjs.com/install.sh有一个非常强大的安装脚本。您可以下载并运行它。

以下是使用curl的示例:

curl -L https://npmjs.com/install.sh | sh