13

Why do I get the error below? My grunt version is > v0.4.0

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

+-- UNMET PEER DEPENDENCY grunt@>=0.4.0

Error messages:

..Projects\Hartz\Hartz>npm install grunt-contrib-concat --save-dev Hartz@1.0.0 C:..\Projects\Hartz\Hartz +-- UNMET PEER DEPENDENCY grunt@>=0.4.0 `-- grunt-contrib-concat@1.0.1

npm WARN grunt-contrib-jshint@1.0.0 requires a peer of grunt@>=0.4.0 but none was installed. npm WARN grunt-contrib-concat@1.0.1 requires a peer of grunt@>=0.4.0 but none was installed. npm WARN Hartz@1.0.0 No repository field.

grunt -V

grunt-cli v1.2.0
grunt v1.0.1

Legends
  • 21,202
  • 16
  • 97
  • 123

1 Answers1

17

Install grunt locally (not globally).

npm install grunt --save-dev

It should help, because grunt-contrib-concat is looking for locally installed grunt module.

Andrzej Karpuszonak
  • 8,896
  • 2
  • 38
  • 50
  • And how to tell it, to use the globally installed grunt module? – Legends Sep 04 '16 at 10:41
  • This is good question. My understanding is that its not possible by design - npm is built around the idea NOT to have global dependencies repository, but to have local one instead, and every module should require particular and possibly different version of the same module. For example, one of your modules requires moduleA@1.0 and another requires moduleA@2.0. So your node_modules directory will have BOTH versions of `moduleA` but in different versions. Does it make sense? – Andrzej Karpuszonak Sep 04 '16 at 10:52
  • 1
    No, it does not make sense. For example nuget, at least the newer version, installs the packages into a global folder --> different packages with different versions. The benefit is, you don't have packages scattered locally in every solution you create. The solutions then reference the specific version from the global packages folder. For example, your refrence MVC v2.x.x in 5 different solutions: Local approach: you have the same five packages deployed locally. Global approach: one package, referenced by all solutions -> centralized and saves a bit of disk space ;-) – Legends Nov 25 '16 at 14:58
  • 4
    I get this warning by typing in this answer! eg "npm install grunt --save-dev" gives me "grunt-newer@0.8.0 requires a peer of grunt@~0.4.1 but none was installed" – PandaWood Dec 16 '16 at 02:42
  • 4
    I get the same error when running npm install grunt --save-dev – AlxVallejo Dec 17 '16 at 01:21
  • i dont think this is the right answer different modules require different versions of grunt – nolawi Feb 23 '17 at 03:06
  • This answer did not solve my problem. Should it be noted if bowerjs is used to manage dependencies and what impact that may have? – JDennis Jan 24 '19 at 19:16