求助 sudo npm command not found
发布于 11 年前 作者 skindred 16445 次浏览 最后一次编辑是 8 年前
sudo: npm: command not found
yang[@johnyang](/user/johnyang):/usr$ node -v
v0.10.21
yang[@johnyang](/user/johnyang):/usr$ npm -v
1.3.11
5 回复

npm install xx

npm http GET https://registry.npmjs.org/pomelo

npm http 304 https://registry.npmjs.org/pomelo npm ERR! Error: EACCES, mkdir '/usr/local/node/lib/node_modules/pomelo’ npm ERR! { [Error: EACCES, mkdir ‘/usr/local/node/lib/node_modules/pomelo’] npm ERR! errno: 3, npm ERR! code: ‘EACCES’, npm ERR! path: ‘/usr/local/node/lib/node_modules/pomelo’, npm ERR! fstream_type: ‘Directory’, npm ERR! fstream_path: ‘/usr/local/node/lib/node_modules/pomelo’, npm ERR! fstream_class: ‘DirWriter’, npm ERR! fstream_stack: npm ERR! [ ‘/usr/local/node/lib/node_modules/npm/node_modules/fstream/lib/dir-writer.js:36:23’, npm ERR! ‘/usr/local/node/lib/node_modules/npm/node_modules/mkdirp/index.js:37:53’, npm ERR! ‘Object.oncomplete (fs.js:107:15)’ ] } npm ERR! npm ERR! Please try running this command again as root/Administrator.

npm ERR! System Linux 3.8.0-29-generic npm ERR! command “/usr/local/node/bin/node” “/usr/local/node/bin/npm” “install” “pomelo” "-g" npm ERR! cwd /usr/lib npm ERR! node -v v0.10.21 npm ERR! npm -v 1.3.11 npm ERR! path /usr/local/node/lib/node_modules/pomelo npm ERR! fstream_path /usr/local/node/lib/node_modules/pomelo npm ERR! fstream_type Directory npm ERR! fstream_class DirWriter npm ERR! code EACCES npm ERR! errno 3 npm ERR! stack Error: EACCES, mkdir '/usr/local/node/lib/node_modules/pomelo’ npm ERR! fstream_stack /usr/local/node/lib/node_modules/npm/node_modules/fstream/lib/dir-writer.js:36:23 npm ERR! fstream_stack /usr/local/node/lib/node_modules/npm/node_modules/mkdirp/index.js:37:53 npm ERR! fstream_stack Object.oncomplete (fs.js:107:15) npm ERR! Error: EACCES, open 'npm-debug.log’ npm ERR! { [Error: EACCES, open ‘npm-debug.log’] errno: 3, code: ‘EACCES’, path: ‘npm-debug.log’ } npm ERR! npm ERR! Please try running this command again as root/Administrator.

npm ERR! System Linux 3.8.0-29-generic npm ERR! command “/usr/local/node/bin/node” “/usr/local/node/bin/npm” “install” “pomelo” "-g" npm ERR! cwd /usr/lib npm ERR! node -v v0.10.21 npm ERR! npm -v 1.3.11 npm ERR! path npm-debug.log npm ERR! code EACCES npm ERR! errno 3 npm ERR! stack Error: EACCES, open 'npm-debug.log’ npm ERR! npm ERR! Additional logging details can be found in: npm ERR! /usr/lib/npm-debug.log npm ERR! not ok code 0

npm ERR! Please try running this command again as root/Administrator.

root登录后

root@johnyang:~# node -v The program ‘node’ can be found in the following packages:

  • node
  • nodejs Try: apt-get install <selected package> root@johnyang:~#

原来改下.bashrc就好了……

回到顶部