【问题标题】:error while installing gruntjs (node.js/npm package)安装 gruntjs(node.js/npm 包)时出错
【发布时间】:2013-05-01 19:55:40
【问题描述】:

我正在尝试安装grunt.js。正如official docs 所说,我应该跑

npm install -g grunt-cli

以 root 身份(我使用的是 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?

【问题讨论】:

  • 您使用的是什么节点版本?好像很久以前就修复了:stackoverflow.com/questions/4938592/…
  • 0.4.9 来自 oneiric ocelot 包。好吧,我不太明白这到底是怎么回事,但我只想安装grunt.js...

标签: node.js npm gruntjs


【解决方案1】:

解决方案相当棘手......我正在使用 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。现在我有了一个闪亮的0.10.5,sudo npm install 运行良好,没有任何抱怨。

【讨论】:

    猜你喜欢
    • 2011-11-22
    • 2015-10-01
    • 1970-01-01
    • 2011-12-04
    • 1970-01-01
    • 2013-02-25
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多