簡體   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