最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to fix requires a peer of grunt@~0.4.0 while installing grunt plugins? - Stack Overflow

programmeradmin0浏览0评论

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 [email protected] requires a peer of grunt@~0.4.0 but none is installed. You must install peer dependencies yourself.

npm WARN [email protected] requires a peer of grunt@~0.4.0 but none is installed. You must install peer dependencies yourself.

npm WARN [email protected] requires a peer of grunt@~0.4.1 but none is installed. You must install peer dependencies yourself.

How can I fix them?

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 [email protected] requires a peer of grunt@~0.4.0 but none is installed. You must install peer dependencies yourself.

npm WARN [email protected] requires a peer of grunt@~0.4.0 but none is installed. You must install peer dependencies yourself.

npm WARN [email protected] requires a peer of grunt@~0.4.1 but none is installed. You must install peer dependencies yourself.

How can I fix them?

Share Improve this question edited Oct 6, 2024 at 9:27 user4136999 asked Nov 26, 2018 at 11:57 Noha ShehabNoha Shehab 4136 silver badges12 bronze badges 1
  • 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 Commented Nov 26, 2018 at 12:18
Add a ment  | 

3 Answers 3

Reset to default 0

mostly you didn't installed grunt locally

try to install grunt locally by run this mand

npm install grunt --save-dev

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

[email protected] 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:

[email protected] --save-dev

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 plete 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

发布评论

评论列表(0)

  1. 暂无评论