Courage
Courage

Reputation: 543

can not install grunt with npm command line

my node version is v6.6.0. my npm version is v4.0.5.

using npm ls -g already found grunt-cli has been installed

however, when I use npm install grunt -save-dev it show

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

I have check this simple issue for two hours. but it does not solve. thanks

Upvotes: 3

Views: 1418

Answers (3)

Seth Connell
Seth Connell

Reputation: 875

The issue is in your package.json file. You should change the name.

In "name": "grunt", set grunt to something else and it should work perfectly.

Upvotes: 1

Faruk
Faruk

Reputation: 31

I have the same issue. I renamed folder's (folder that I run GitBash) name and fixed. Folder's name was "grunt" , I changed it "grunt-typescript" and tried again

  • npm install grunt --save

I worked! :)

Upvotes: 0

Courage
Courage

Reputation: 543

I have resolved this issue, because my package.json name is same with the grunt name. thanks stackoverflow space.

Upvotes: 4

Related Questions