安装时出现 NPM 权限错误 [英] NPM permission error while installing

查看:74
本文介绍了安装时出现 NPM 权限错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在我的服务器上安装 yeoman,但由于某种原因,我一直收到权限被拒绝的错误.

i am trying to install yeoman on my server but for some reason do i keep getting a permission denied error.

$npm install -g yo
/root/.node/bin/yo -> /root/.node/lib/node_modules/yo/cli.js

> yo@1.3.3 postinstall /root/.node/lib/node_modules/yo
> yodoctor

sh: 1: yodoctor: Permission denied

npm ERR! yo@1.3.3 postinstall: `yodoctor`
npm ERR! Exit status 127
npm ERR! 
npm ERR! Failed at the yo@1.3.3 postinstall script.
npm ERR! This is most likely a problem with the yo package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     yodoctor
npm ERR! You can get their info via:
npm ERR!     npm owner ls yo
npm ERR! There is likely additional logging output above.
npm ERR! System Linux 3.13.0-37-generic
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install" "-g" "yo"
npm ERR! cwd /root
npm ERR! node -v v0.10.33
npm ERR! npm -v 1.4.28
npm ERR! code ELIFECYCLE
npm ERR! not ok code 0

我尝试重新安装 ubuntu (14.04) 但没有任何效果.

i have tried to reinstall ubuntu (14.04) but nothing works.

推荐答案

我觉得 Shantaru 是对的,你需要用 sudo 来做.

I think Shantaru is right, you need to do it with sudo.

试试这个

sudo npm uninstall -g yo
sudo npm cache clean
sudo npm install -g yo

我在几周前遇到了类似的问题,并且有效.

I have a similar problem weeks ago and that works.

如果这不起作用,请先执行此操作:

If that didn't work, do this before:

npm config set unsafe-perm true

这篇关于安装时出现 NPM 权限错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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