繁体   English   中英

安装gruntjs时出错(node.js / npm软件包)

[英]error while installing gruntjs (node.js/npm package)

我正在尝试安装grunt.js 正如官方文档所说,我应该运行

npm install -g grunt-cli

作为根用户(我正在使用ubuntu linux)。 我正在尝试-并且出现以下错误:

$ sudo npm install -g grunt-cli
npm ERR! sudon't! 
npm ERR! sudon't! Running npm as root is not recommended!
npm ERR! sudon't! Seriously, don't do this!
npm ERR! sudon't!
npm ERR! couldn't read package.json in .
npm ERR! Error installing .
npm ERR! Error: ENOENT, No such file or directory 'package.json'
npm ERR! Report this *entire* log at <http://github.com/isaacs/npm/issues>
npm ERR! or email it to <npm-@googlegroups.com>
npm ERR! Just tweeting a tiny part of the error will not be helpful.
npm not ok

有人可以解释一下:

[1] why npm says `sudon't` and grunt docs says `do sudo`? And what is it all about?
[2] I want to install the grunt as a tool. Why does the message complains about missing package.json which is project-dependent (and I don't want to run grunt on any project, I want to install it globally first)?
[3] what can I do to make it install successfully?

该解决方案非常棘手...我正在使用ubuntu oneiric ocelot,该产品一周前仍然得到了维护(还不算老)。 我通过默认的ubuntu软件包安装了node.js,结果就是问题所在-我安装了0.4.9版本,该版本似乎是旧的,奇怪的(我以前没有使用node.js的经验)。 我将其删除,并按照https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager中的说明进行操作-添加了远程软件包存储库并从那里安装了node.js。 现在我有了sudo npm install的闪亮0.10.5 ,工作正常,没有任何抱怨。

暂无
暂无

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM