generator-karma does not satisfy its siblings'

2019-03-11 17:02发布

The same notorious error

npm ERR! peerinvalid The package generator-karma does not satisfy its siblings' peerDependencies requirements!
npm ERR! peerinvalid Peer generator-angular@0.7.1 wants generator-karma@~0.6.0
npm ERR! peerinvalid Peer generator-angular-ui-router@0.5.3 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?

6条回答
2楼-- · 2019-03-11 17:21

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

查看更多
等我变得足够好
3楼-- · 2019-03-11 17:23

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/
查看更多
三岁会撩人
4楼-- · 2019-03-11 17:24

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.

查看更多
ら.Afraid
5楼-- · 2019-03-11 17:30

Try running npm uninstall -g generator-karma

查看更多
劫难
6楼-- · 2019-03-11 17:30

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
查看更多
Fickle 薄情
7楼-- · 2019-03-11 17:33

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.

查看更多
登录 后发表回答