在不使用sudo的情况下安装npm

3
我需要在没有root权限的计算机上安装npm,由于缺少依赖项,我会遇到许多错误。 我附上屏幕截图。 有什么想法吗?谢谢。
2个回答

3

来自 node.js 贡献者 isaacs 的话:

   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


npm��经与Node.js捆绑在一起,不需要单独安装。 - Robert Rossmann

0

高级安装(Unix)

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

以下是使用curl的示例:

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

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接