5

I am trying to install some Grunt plugins like grunt-contrib-clean and grunt-contrib-watch using npm install grunt-contrib-clean --save-dev and npm install grunt-contrib-watch --save-dev

I got these warnings:

npm WARN stellarhse@1.0.0 requires a peer of grunt@~0.4.0 but none is installed. You must install peer dependencies yourself.

npm WARN grunt-contrib-concat@0.3.0 requires a peer of grunt@~0.4.0 but none is installed. You must install peer dependencies yourself.

npm WARN grunt-contrib-cssmin@0.10.0 requires a peer of grunt@~0.4.1 but none is installed. You must install peer dependencies yourself.

How can I fix them?

Thank you.

Community
  • 1
  • 1
Noha Shehab
  • 393
  • 5
  • 12
  • install grunt 0.4.0 or 0.4.1 - the warning is telling you you need grunt for the other package to work but it isn't installed – Pete Nov 26 '18 at 12:18

3 Answers3

0

mostly you didn't installed grunt locally

try to install grunt locally by run this command

npm install grunt --save-dev
Brad Larson
  • 170,088
  • 45
  • 397
  • 571
Mahmoud Zohdi
  • 53
  • 1
  • 5
  • This did not resolve my issue but I saw that this "mostly" worked in another post. https://stackoverflow.com/questions/39315196/requires-a-peer-of-grunt-0-4-0 – JDennis Jan 24 '19 at 19:19
0

I have fixed the problem,

  • First, Ensured that the peer dependencies section in the package.json file is empty
  • Second, I updated npm using

npm update

  • Third, install grunt cli globally using

npm install -g grunt-cli.

  • Finally switched to the path where the project in and complete installing grunt itself and the plugins I need and worked well.

npm install grunt --save-dev

npm install grunt-contrib-watch --save-dev

npm install grunt-contrib-clean --save-dev

Thank you.

Maxim Masiutin
  • 3,991
  • 4
  • 55
  • 72
Noha Shehab
  • 393
  • 5
  • 12
0

In case this helps anyone with a similar problem I just received this error on a successful Grunt 1.0.4 install:

grunt-contrib-concat@0.1.3 requires a peer of grunt@~0.4.0 but none is installed

and none of the above answers worked, ie:

npm update
npm install grunt-contrib-concat --save-dev

did not resolve the problem / get the latest version

The only fix was to find THE LATEST VERSION of grunt-contrib-concat on git and overwrite explicitly:

grunt-contrib-concat@1.0.1 --save-dev