为什么我在安装 karma 和 gulp-karma 时得到 UNMET PEER DEPENDENCY?

Why do I get UNMET PEER DEPENDENCY when I install karma and gulp-karma?

按照 this 教程,我想使用 karma 进行测试。当我安装 karma 和 gulp-karma 时,我收到以下错误消息。它说没有安装 gulp-karma 需要的 karma@1.3.0。当我安装业力时,它说的是一样的。

现在,我无法判断是否安装正确。

我试过删除node_modules目录,清除chache,升级npm,从头启动,结果还是一样。

npm 版本:3.10.8

package.json:

{
  "name": "ui.spa",
  "version": "1.0.0",
  "description": "Framework module for Digital Library",
  "main": "Gulpfile.js",
  "dependencies": {
    "bower": "^1.7.9",
    "gulp": "^3.9.1",
    "gulp-clean": "^0.3.2",
    "gulp-inject": "^4.1.0",
    "gulp-karma": "0.0.5",
    "gulp-typescript": "^2.14.1",
    "gulp-util": "^3.0.7",
    "jasmine": "^2.5.2",
    "jasmine-core": "^2.5.2",
    "karma": "^1.3.0",
    "karma-coverage": "^1.1.1",
    "karma-jasmine": "^1.0.2",
    "karma-phantomjs-launcher": "^1.0.2",
    "merge-stream": "^1.0.0",
    "phantomjs": "^2.1.7",
    "require-dir": "^0.3.0",
    "run-sequence": "^1.2.2",
    "stream-series": "^0.1.1",
    "typings": "^1.4.0"
  },
  "devDependencies": {},
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC"
}

C:\Projects\sayusiando.visualstudio.com_git\DigitalLibrary\src\Framework\Framework.UI.Spa>npm install karma --save ui.spa@1.0.0 C:\Projects\sayusiando.visualstudio.com_git\DigitalLibrary\src\Framework\Framework.UI.Spa `-- UNMET PEER DEPENDENCY karma@1.3.0

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules\chokidar\node_modules\fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.0.14: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"}) npm WARN gulp-karma@0.0.5 requires a peer of karma@>=0.10 <=0.13 but none was installed. npm WARN ui.spa@1.0.0 No repository field. npm ERR! code 1

C:\Projects\sayusiando.visualstudio.com_git\DigitalLibrary\src\Framework\Framework.UI.Spa>npm install gulp-karma --save ui.spa@1.0.0 C:\Projects\sayusiando.visualstudio.com_git\DigitalLibrary\src\Framework\Framework.UI.Spa +-- gulp-karma@0.0.5 `-- UNMET PEER DEPENDENCY karma@1.3.0

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules\chokidar\node_modules\fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.0.14: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"}) npm WARN gulp-karma@0.0.5 requires a peer of karma@>=0.10 <=0.13 but none was installed. npm WARN ui.spa@1.0.0 No repository field.

C:\Projects\sayusiando.visualstudio.com_git\DigitalLibrary\src\Framework\Framework.UI.Spa>

问题的根源在于 gulp-karma 包现在 deprecated