我的节点版本是v6.6.0。 我的npm版本是v4.0.5。
使用npm ls -g已经发现grunt-cli已经安装
但是,当我使用npm install grunt -save-dev时显示
SuoYong:grunt suoyong$ npm install grunt --save-dev
npm ERR! Darwin 15.3.0
npm ERR! argv "/usr/local/Cellar/node/6.6.0/bin/node" "/usr/local/bin/npm" "install" "grunt" "--save-dev"
npm ERR! node v6.6.0
npm ERR! npm v4.0.5
npm ERR! code ENOSELF
npm ERR! Refusing to install package with name "grunt" under a package
npm ERR! also called "grunt". Did you name your project the same
npm ERR! as the dependency you're installing?
npm ERR!
npm ERR! For more information, see:
npm ERR! <https://docs.npmjs.com/cli/install#limitations-of-npms-install-algorithm>
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! <https://github.com/npm/npm/issues>
npm ERR! Please include the following file with any support request:
npm ERR! /Users/suoyong/Node/grunt/npm-debug.log
我已经检查了这个简单的问题两个小时了。但它没有解决。 感谢
答案 0 :(得分:2)
我已经解决了这个问题,因为我的package.json名称与grunt名称相同。谢谢stackoverflow空间。
答案 1 :(得分:1)
问题出在你的package.json文件中。你应该更改名称。
在"name": "grunt"
中,将grunt设置为其他内容,它应该可以正常工作。
答案 2 :(得分:0)
我有同样的问题。我重命名了文件夹&(我运行GitBash的文件夹)名称并修复了。 文件夹的名称是&#34; grunt&#34; ,我改变了它&#34; grunt-typescript&#34;并再次尝试
我工作了! :)