“sudo npm install -g grunt-cli”给我一个错误 [英] "sudo npm install -g grunt-cli" gives me an error

查看:132
本文介绍了“sudo npm install -g grunt-cli”给我一个错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



这是错误:

$ b $在Linux 12.04上安装gruntjs时出现错误(带镜像包源代码) b

  sudo npm install -g grunt-cli 

npm ERR!错误:ENOENT,打开'/home/havetl/.npm/d63f3d0b-grunt-cli.lock'
npm ERR!如果您需要帮助,可以通过以下链接报告此日志:
npm ERR! < HTTP://github.com/isaacs/npm/issues>
npm ERR!或通过电子邮件发送至:
npm ERR! < npm-@googlegroups.com>

npm ERR!系统Linux 3.5.0-23-generic
npm ERR!命令/ usr / bin / node/ usr / bin / npminstall-ggrunt-cli
npm ERR! cwd / home / havetl
npm ERR!节点-v v0.10.18
npm ERR! npm -v 1.3.8
npm ERR!路径/home/havetl/.npm/d63f3d0b-grunt-cli.lock
npm ERR!代码ENOENT
npm ERR! errno 34
npm ERR!错误:EACCES,打开'npm-debug.log'
npm ERR! {[Error:EACCES,打开'npm-debug.log'] errno:3,代码:'EACCES',路径:'npm-debug.log'}
npm ERR!
npm ERR!请尝试以root / Administrator身份再次运行此命令。

npm ERR!系统Linux 3.5.0-23-generic
npm ERR!命令/ usr / bin / node/ usr / bin / npminstall-ggrunt-cli
npm ERR! cwd / home / havetl
npm ERR!节点-v v0.10.18
npm ERR! npm -v 1.3.8
npm ERR!路径npm-debug.log
npm ERR!代码EACCES
npm ERR! errno 3
npm ERR!堆栈错误:EACCES,打开'npm-debug.log'
npm ERR!
npm ERR!附加的日志记录细节可以在以下位置找到:
npm ERR! /home/havetl/npm-debug.log
npm ERR!不是好的代码0

感谢任何想法!

sudo 的软件包被认为是不好的做法,因为您允许该软件包具有完整性控制你的系统,你不能也不应该信任这些具有root权限的软件包。出于这个确切原因,考虑Debian的长版本是保护最终用户免受社区维护软件包的极端例子。

introduction to npmrel =nofollow> http://howtonode.org/introduction-to-npm



你应该按照Issaacs的建议和 chown 您的 / usr / local 文件夹,因此您拥有RW权限。


I get an error when trying to install gruntjs on a linux 12.04 (with a mirrored packages source)

Here is the error:

 sudo npm install -g grunt-cli

npm ERR! Error: ENOENT, open '/home/havetl/.npm/d63f3d0b-grunt-cli.lock'
npm ERR! If you need help, you may report this log at:
npm ERR!     <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR!     <npm-@googlegroups.com>

npm ERR! System Linux 3.5.0-23-generic
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install" "-g" "grunt-cli"
npm ERR! cwd /home/havetl
npm ERR! node -v v0.10.18
npm ERR! npm -v 1.3.8
npm ERR! path /home/havetl/.npm/d63f3d0b-grunt-cli.lock
npm ERR! code ENOENT
npm ERR! errno 34
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.5.0-23-generic
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install" "-g" "grunt-cli"
npm ERR! cwd /home/havetl
npm ERR! node -v v0.10.18
npm ERR! npm -v 1.3.8
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!     /home/havetl/npm-debug.log
npm ERR! not ok code 0

Thanks for any idea!

解决方案

According to the maintainer of npm, installing packages with sudo is considered bad practice because you are allowing that package to have complete control of your system and you can't and SHOULDN'T trust these packages with root access. Think Debian's long release cycles as an extreme example of protecting end users from community maintained packages for this exact reason.

http://howtonode.org/introduction-to-npm

You should do what Issaacs suggests and chown your /usr/local folder so you have RW permissions.

这篇关于“sudo npm install -g grunt-cli”给我一个错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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