سؤال

package.json

I have the following package.json

...
"devDependencies": {
    "karma-coverage": "~0.1.3",
    "karma-chrome-launcher": "~0.1.1",
    "karma-firefox-launcher": "~0.1.2",
    "karma-html-reporter": "~0.1.1",
    "karma-jasmine": "~0.1.3",
    "karma-phantomjs-launcher": "~0.1.1",
    "karma-safari-launcher": "~0.1.1",
    "karma-script-launcher": "~0.1.0",
    "grunt-contrib-jshint": "~0.1.1",
    "grunt-contrib-concat": "~0.1.2",
    "grunt-contrib-uglify": "~0.1.1",
    "grunt-contrib-watch": "~0.5.3",
    "grunt-contrib-clean": "~0.4.0",
    "grunt-contrib-connect": "~0.5.0",
    "grunt-karma": "~0.6.2",
    "grunt-concurrent": "~0.4.2",
    "time-grunt": "~0.1.1",
    "load-grunt-tasks": "~0.2.0",
    "jshint-stylish": "~0.1.3"
},
"peerDependencies": {
    "karma": ">=0.10",
    "grunt": ">=0.4"
},
...

> karma --version

When I call karma --version on the console, I get the following output:

> karma --version
Karma version: 0.12.16

> npm install

When I afterwards call npm install I get the following error:

> npm install
npm WARN package.json jsdom@0.1.0 No README data
npm http GET https://registry.npmjs.org/jquery
npm http 304 https://registry.npmjs.org/jquery
npm ERR! peerinvalid The package karma does not satisfy its siblings' peerDependencies requirements!
npm ERR! peerinvalid Peer karma-coverage@0.1.5 wants karma@>=0.9
npm ERR! peerinvalid Peer karma-chrome-launcher@0.1.3 wants karma@>=0.9.3
npm ERR! peerinvalid Peer karma-firefox-launcher@0.1.3 wants karma@>=0.9
npm ERR! peerinvalid Peer karma-html-reporter@0.1.3 wants karma@>=0.9
npm ERR! peerinvalid Peer karma-jasmine@0.1.5 wants karma@>=0.9
npm ERR! peerinvalid Peer karma-phantomjs-launcher@0.1.4 wants karma@>=0.9
npm ERR! peerinvalid Peer karma-safari-launcher@0.1.1 wants karma@>=0.9
npm ERR! peerinvalid Peer karma-script-launcher@0.1.0 wants karma@>=0.9
npm ERR! peerinvalid Peer grunt-karma@0.6.2 wants karma@~0.10.0

npm ERR! System Darwin 13.1.0
npm ERR! command "node" "/usr/local/bin/npm" "install"
npm ERR! cwd /Projects/jsdom
npm ERR! node -v v0.10.28
npm ERR! npm -v 1.4.10
npm ERR! code EPEERINVALID
npm ERR! Error: EACCES, open 'npm-debug.log'
npm ERR!  { [Error: EACCES, open 'npm-debug.log'] errno: 3, code: 'EACCES', path: 'npm-debug.log' }
npm ERR! 
npm ERR! Please try running this command again as root/Administrator.

npm ERR! System Darwin 13.1.0
npm ERR! command "node" "/usr/local/bin/npm" "install"
npm ERR! cwd /Projects/jsdom
npm ERR! node -v v0.10.28
npm ERR! npm -v 1.4.10
npm ERR! path npm-debug.log
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! stack Error: EACCES, open 'npm-debug.log'
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /Projects/jsdom/npm-debug.log
npm ERR! not ok code 0

The problem

Why npm doesn't like my karma? :)

هل كانت مفيدة؟

المحلول

Your peerDependancies appears to be wrong, you should be specifying the name of the package, and then the versionied packages it needs,

"name": "karma-coverage",
  "peerDependencies": {
    "karma": "0.9"
  }
}

See the Documentation from npm

although it looks like none of your packages need a particular version of karma, so you could just try adding "karma": "10.0" at the start of your dev dependancies

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top