11

実行すると、このエラーが発生します

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

私は何をすべきか?私はこれらを試しましたが成功しませんでした:

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)

It worked実際、それは何かをしました。最後に何が大きな嘘であるかを書いていることがわかります。

4

2 に答える 2

18

なぜあなたはそれを実行してい/usrますか?

本当に必要な場合は、このページで root として実行することをお勧めします。つまり、次のようになります。

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

ただし、それを実行する前に、システムが壊れないことを確認してください。

于 2011-07-19T20:03:51.887 に答える
2

npm インストールのアクセス許可を台無しにして、再インストール時にこのエラーが発生しました。私はそれを最も粗雑な方法で解決しました。問題を引き起こしたsudo rm -rfディレクトリツリーを自由に ing し、node.js を再コンパイルして npm を再インストールしました。

他のすべてが失敗した場合は、それにフォールバックできます。

于 2011-07-19T19:27:54.227 に答える