npm和karma的奇怪版本问题

时间:2014-05-10 21:49:33

标签: node.js npm karma-runner

的package.json

我有以下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

当我在控制台上调用karma --version时,我得到以下输出:

> karma --version
Karma version: 0.12.16

> npm install

当我之后致电npm install时,我收到以下错误:

> 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

问题

为什么npm不喜欢我的karma? :)

1 个答案:

答案 0 :(得分:0)

你的peerDependancies似乎是错误的,你应该指定包的名称,然后指定它需要的版本化的包,

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

See the Documentation from npm

虽然看起来你的任何一个包都不需要特定版本的业力,所以你可以尝试添加"业力":" 10.0"在您的开发依赖开始时