与grunt和flatiron peer的npm peerDependency问题

时间:2013-02-14 22:17:02

标签: node.js npm gruntjs nodejitsu

在发布这个问题时,我想出了答案,但我会在这里发布以防万一,以防其他人,也许有人可以帮助为什么发生的事情。< / em>的

当我跑步时:

sudo npm install -g grunt

它的最后一部分说:

/usr/bin/grunt -> /usr/lib/node_modules/grunt/bin/grunt
npm ERR! peerinvalid The package flatiron does not satisfy its siblings' peerDependencies requirements!
npm ERR! peerinvalid Peer flatiron-cli-config@0.1.3 wants flatiron@~0.1.9
npm ERR! peerinvalid Peer flatiron-cli-users@0.1.1 wants flatiron@~0.1.9

npm ERR! System Linux 3.5.0-23-generic
npm ERR! command "nodejs" "/usr/bin/npm" "install" "-g" "grunt"
npm ERR! cwd /home/explunit
npm ERR! node -v v0.8.19
npm ERR! npm -v 1.2.9
npm ERR! code EPEERINVALID
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /home/explunit/npm-debug.log
npm ERR! not ok code 0

正如你在上面所看到的,我在节点0.8.19和npm 1.2.9(最新的ppa:来自Ubuntu 12.10的chris-lea)。

我试过的其他事情:

  • 在新的Ubuntu安装上做了同样的事情。没有错误。脚本输出看起来相同,直到最后几个错误行。
  • 跑“sudo npm cache clean”并再次尝试。没有运气。
  • 跑“npm list”,没有列出其他内容

2 个答案:

答案 0 :(得分:58)

我的错误是没有在npm list命令中附加-g。

npm list -g

一旦我这样做,我看到了我的全局安装模块列表(例如bower,jshint,mocha),最后:

npm ERR! peer invalid: flatiron@0.3.0 /usr/lib/node_modules/jitsu/node_modules/flatiron
npm ERR! not ok code 0

然后我运行此命令以查看哪些使用了熨斗:

npm list -g flatiron

在这种情况下它是jitsu,我不再使用的模块。我跑了

sudo npm uninstall -g jitsu
sudo npm uninstall -g grunt

然后再次运行原始命令。 请注意以后出现在此问题中的任何人:release of 0.4现在grunt-cli之后全局重新安装grunt命令行的正确模块,而非grunt,就像我问原始问题时一样

如果我真的想保持jitsu我可以更新它而不是卸载它(感谢@BenAtkin):

npm install -g jitsu

然后再次运行原始命令。有关更多背景信息,请参阅this blog post about peerDependency being added in node 0.8.19

答案 1 :(得分:9)

如果你不介意保持jitsu安装,你可以升级jitsu,这应该工作。

npm install -g jitsu
npm install -g grunt-cli