npm install需要sudo,sudo npm install返回命令找不到Ubuntu(使用nvm)

时间:2015-07-22 01:21:54

标签: linux ubuntu command-line npm sudo

我对deving相当新,我认为我安装了sudo npm -g会导致权限问题。我有一些帮助,我们在节点文件node_modules和npm文件的所有实例上都使用了rm -Rf。它解决了我遇到的问题(全局运行learnyounode命令)但是我的npm安装不再工作(需要sudo),当我sudo npm install时它返回sudo:npm:command not found

这是我安装npm时返回的错误

npm WARN deprecated gulp-rimraf@0.1.1: Use npmjs.org/del instead, see https://github.com/gulpjs/gulp/blob/master/docs/recipes/delete-files-folder.md npm WARN deprecated sequelize@2.0.5: critical security fix in v3.0.0 npm ERR! Error: EACCES, mkdir '/home/dmeow/.npm/bluebird/2.9.34' npm ERR! { [Error: EACCES, mkdir '/home/dmeow/.npm/bluebird/2.9.34'] npm ERR! errno: 3, npm ERR! code: 'EACCES', npm ERR! path: '/home/dmeow/.npm/bluebird/2.9.34' } npm ERR! npm ERR! Please try running this command again as root/Administrator.

npm ERR! System Linux 3.13.0-46-generic npm ERR! command "/home/dmeow/.nvm/v0.10.32/bin/node" "/home/dmeow/.nvm/v0.10.32/bin/npm" "install" npm ERR! cwd /home/dmeow/GG/Airship npm ERR! node -v v0.10.32 npm ERR! npm -v 1.4.28 npm ERR! path /home/dmeow/.npm/bluebird/2.9.34 npm ERR! code EACCES npm ERR! errno 3 npm ERR! stack Error: EACCES, mkdir '/home/dmeow/.npm/bluebird/2.9.34' npm ERR! npm ERR! Additional logging details can be found in: npm ERR! /home/dmeow/GG/Airship/npm-debug.log npm ERR! not ok code 0

任何人都可以提供一些帮助,并提供非常详细的说明。非常感谢你。

1 个答案:

答案 0 :(得分:1)

你的可执行文件可能搞砸了。

卸载

sudo apt-get --purge remove npm

重新安装

sudo apt-get install npm

当我拥有它时,这就解决了这个问题。