generator-karma does not satisfy its siblings' peerDependencies requirements
Asked Answered
T

6

28

The same notorious error

npm ERR! peerinvalid The package generator-karma does not satisfy its siblings' peerDependencies requirements!
npm ERR! peerinvalid Peer [email protected] wants generator-karma@~0.6.0
npm ERR! peerinvalid Peer [email protected] wants generator-karma@~0.5.0

npm ERR! System Darwin 12.5.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "-g" "generator-angular"
npm ERR! cwd /Users/dmitrizaitsev/Dropbox/Priv/APP/my-yo-project
npm ERR! node -v v0.10.24
npm ERR! npm -v 1.3.21
npm ERR! code EPEERINVALID

comes from installation various packages, e.g. for

npm update -g yo

The only found advice to uninstall generator-karma does not help - it re-installs back.

Any better explanation of why it happens and working solution?

Thereof answered 15/1, 2014 at 15:6 Comment(2)
Just making it clear, you did try sudo npm update -g generator-karma correct? You may also try looking at /node_modules/generator-karma/package.json, and view the version to see if it's above equal or above 0.6.0.Thermostat
Yes, I tried that too. I was able to get rid of that error by uninstalling generator-angular-ui-router, which seems to use older version of generator-karma. Kind of annoying there is no better way.Thereof
E
26

You need to update all of your globally installed NPM packages. Run this command from your console:

npm update -g

This command will update all the packages listed to the latest version (specified by the tag config).

It will also install missing packages.

When you specify the -g flag, this command will update globally installed packages. If no package name is specified, all packages in the specified location (global or local) will be updated.

Eyrir answered 5/6, 2014 at 3:18 Comment(4)
Just running this fixed the problem for meExceed
This command totally screwed npm for me. It came back with lot of error and now I have this : -bash: /usr/local/bin/npm: No such file or directory. Think twice before running thisSauder
@Sauder npm has destructive behavior of deleting itself sometimes upon failure. You can simply restore it by re-installing node. Annoying but works.Thereof
Cannot find module '/Users/username/.npm-packages/lib/node_modules/npm/lib/build.js'Davenport
C
47

Try running npm uninstall -g generator-karma

Conner answered 18/2, 2014 at 14:7 Comment(4)
Any explanation what exactly happens here?Thereof
not really sorry, I just had this generator somehow installed globally and uninstalling it fixed it. I reckon there have been a lot of changes during different versions of karma.Conner
Good call. I ran into this when trying to install webpack and this solution satisfies it as well.Toritorie
This worked for me. Thanks! I then re-installed karma afterwards and everything was happy.Davenport
E
26

You need to update all of your globally installed NPM packages. Run this command from your console:

npm update -g

This command will update all the packages listed to the latest version (specified by the tag config).

It will also install missing packages.

When you specify the -g flag, this command will update globally installed packages. If no package name is specified, all packages in the specified location (global or local) will be updated.

Eyrir answered 5/6, 2014 at 3:18 Comment(4)
Just running this fixed the problem for meExceed
This command totally screwed npm for me. It came back with lot of error and now I have this : -bash: /usr/local/bin/npm: No such file or directory. Think twice before running thisSauder
@Sauder npm has destructive behavior of deleting itself sometimes upon failure. You can simply restore it by re-installing node. Annoying but works.Thereof
Cannot find module '/Users/username/.npm-packages/lib/node_modules/npm/lib/build.js'Davenport
R
3

I had a similar issue and I did this in terminal:

rm -rf /usr/local/lib/node_modules/karma-*

and then updated the package.json:

  "devDependencies": {
    "karma": "0.12.0",
    ...
  }

then reinstall

sudo npm install karma

It worked for me

Rodolphe answered 13/3, 2014 at 6:10 Comment(1)
You should never sudo npm -- see https://mcmap.net/q/503117/-how-to-remove-sudo-requirement-for-local-npm-installThereof
E
2

It fixed it by running this command, which installs the latest version from GitHub:

$ npm install -g git://github.com/iamblue/generator-angular-ui-router.git
Ellery answered 12/2, 2014 at 22:51 Comment(1)
I had tried all the others - for Windows your solution was the only one that workedDropsy
G
1

i was able to install simply by:

npm install karma-generator

Guess it installs a later version of Karma. I was able to successfully install generator-angular after that. Was able to get coffeescript going as well after doing the above.

Gooseherd answered 16/1, 2014 at 5:6 Comment(0)
S
0

I had permissions issues with some of the directories under /usr/local/lib/node_modules. I must have installed some packages with sudo but most under my own user id. I solved this issue on a Mac with these commands:

sudo chown -R `whoami` /usr/local/lib/node_modules/
sudo chgrp -R admin /usr/local/lib/node_modules/
Soffit answered 19/5, 2015 at 18:14 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.