Node.js:NPM 安装失败 [英] Node.js : NPM Install Fails

查看:56
本文介绍了Node.js:NPM 安装失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我运行,我会收到这个错误

I get this error if I run

curl http://npmjs.org/install.sh | sh

即使使用 sudo.

    cirk@cirk-Parallels-Virtual-Platform:~$ curl http://npmjs.org/install.sh | sh
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  3902  100  3902    0     0   6138      0 --:--:-- --:--:-- --:--:-- 12546
fetching: http://registry.npmjs.org/npm/-/npm-1.0.18.tgz
0.4.9
1.0.18
Skipping 0.x cruft clean
! [ -d .git ] || git submodule update --init --recursive
node cli.js cache clean
node cli.js rm npm -g -f --loglevel error
node cli.js install -g -f
npm ERR! error installing npm@1.0.18 Error: EACCES, Permission denied '../lib/node_modules/npm/bin/npm.js'
npm ERR! Error: EACCES, Permission denied '../lib/node_modules/npm/bin/npm.js'
npm ERR! 
npm ERR! Please use 'sudo' or log in as root to run this command.
npm ERR! 
npm ERR!     sudo npm "install" "-g" "-f"
npm ERR! 
npm ERR! or set the 'unsafe-perm' config var to true.
npm ERR! 
npm ERR!     npm config set unsafe-perm true
npm ERR! 
npm ERR! System Linux 2.6.38-10-generic
npm ERR! command "node" "/tmp/npm.1568/package/cli.js" "install" "-g" "-f"
npm ERR! cwd /tmp/npm.1568/package
npm ERR! node -v v0.4.9
npm ERR! npm -v 1.0.18
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /tmp/npm.1568/package/npm-debug.log
npm not ok
It worked

我该怎么办?我尝试了这些但没有成功:

What should I do? I tried these with no success:

chown -R cirk /usr/lib/nodejs
// and also this
chown -R cirk /usr/lib/node_modules (node_modules is empty it tries to install NPM here or what)

实际上它做了一些事情,你可以看到它在最后写它有效这是一个大谎言!

actually it did something, as you can see it writes at the end It worked what is a big lie!

推荐答案

你为什么要在 /usr 中运行它?

Why are you running that in /usr?

如果您确实需要,此页面建议您可以以 root 身份运行,所以那将是:

If you really need to, this page suggests you may run that as root, so that would be:

curl https://www.npmjs.com/install.sh | sudo sh

但在运行之前,您最好确保它不会破坏您的系统.

But you better make sure it won't break your system, before running that.

这篇关于Node.js:NPM 安装失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆