简体   繁体   English

“ sudo npm install -g grunt-cli”给我一个错误

[英]“sudo npm install -g grunt-cli” gives me an error

I get an error when trying to install gruntjs on a linux 12.04 (with a mirrored packages source) 尝试在Linux 12.04上安装gruntjs时出现错误(带有镜像包源)

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. 根据npm的维护者的说法,使用sudo安装软件包被认为是不好的做法,因为您允许该软件包完全控制您的系统,并且您不能也不应该通过根访问权限信任这些软件包。 Think Debian's long release cycles as an extreme example of protecting end users from community maintained packages for this exact reason. 出于这个确切的原因,可以将Debian漫长的发布周期视为保护最终用户免受社区维护的软件包的极端示例。

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

You should do what Issaacs suggests and chown your /usr/local folder so you have RW permissions. 你应该做的Issaacs建议和chown/usr/local文件夹,以便您有RW权限。

I've had this problem before; 我以前遇到过这个问题; sometimes for global packages your current working directory has to be ~/ (but I'm not sure why this is!). 有时对于全局包,您当前的工作目录必须为~/ (但是我不确定为什么会这样!)。 Try: 尝试:

cd ~/; sudo npm install -g grunt-cli

This blog worked for me : 这个博客对我有用:

http://slopjong.de/2012/10/31/how-to-install-the-latest-nodejs-in-ubuntu/ http://slopjong.de/2012/10/31/how-to-install-the-latest-nodejs-in-ubuntu/

the error was because in ubuntu v12 few of the dependencies were not available for the latest version of Node. 该错误是因为在ubuntu v12中,很少有依赖项对于最新版本的Node不可用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 npm install -g grunt-cli在Linux中失败了 - npm install -g grunt-cli failed in Linux 为什么“npm install -g grunt-cli”不能正常工作? - Why "npm install -g grunt-cli" doesn't work correctly? Chocolatey,npm和grunt-cli安装问题 - Chocolatey, npm and grunt-cli installation problems 使用npm安装grunt-cli时出现错误 - Errors when installing grunt-cli with npm apt-get install -g grunt grunt-cli缺少模块 - apt-get install -g grunt grunt-cli missing modules 使用$ sudo npm install -g mean-cli时出错 - Error when using $ sudo npm install -g mean-cli 错误:“npm install -g @ionic/cli”给了我“4 个高严重性漏洞”和“ERR! 错误号 -4058&#39; - Error: 'npm install -g @ionic/cli' gives me '4 high severity vulnerabilities' & 'ERR! errno -4058' sudo npm install给我访问权限被拒绝 - sudo npm install gives me a access denied 我想在 npm 上安装 mechanic,我尝试运行这条线 sudo npm install -g mechanic,但它给了我错误,我不明白这个错误 - I want to install mechanic on npm, I tried to run this line sudo npm install -g mechanic, but it gives me error, I don't understand this error npm -g install karma-cli给出错误(Karma / AngularJS) - npm -g install karma-cli gives error (Karma/AngularJS)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM