由于karma,无法成功运行npm install:未安装任何

时间:2017-06-09 19:27:40

标签: json node.js gruntjs npm-install

我有package.json文件,其中提到了以下devDependencies:

{  "name": "tabs-torico",
  "version": "1.0.0",
  "dependencies": {},
  "devDependencies": {
  "grunt": "~0.4.2",
"grunt-angular-templates": "~0.5.1",
"grunt-autoprefixer": "~0.4.0",
"grunt-cli": "~0.1.11",
"grunt-concurrent": "~0.4.1",
"grunt-connect-proxy": "~0.1.7",
"grunt-contrib-clean": "~0.5.0",
"grunt-contrib-compass": "~0.6.0",
"grunt-contrib-concat": "~0.3.0",
"grunt-contrib-connect": "~0.5.0",
"grunt-contrib-copy": "~0.4.1",
"grunt-contrib-cssmin": "~0.7.0",
"grunt-contrib-htmlmin": "~0.1.3",
"grunt-contrib-jshint": "~0.7.1",
"grunt-contrib-uglify": "~0.2.0",
"grunt-contrib-watch": "^0.5.3",
"grunt-karma": "~0.6.2",
"grunt-newer": "~0.5.4",
"grunt-ngmin": "~0.0.2",
"grunt-protractor-runner": "~0.2.1",
"grunt-rev": "~0.1.0",
"grunt-usemin": "~2.0.0",
"jasmine-core": "^2.6.2",
"jshint-stylish": "~0.1.3",
"karma": "^0.10.10",
"karma-chrome-launcher": "^0.1.12",
"karma-html2js-preprocessor": "~0.1.0",
"karma-jasmine": "^0.1.6",
"karma-ng-html2js-preprocessor": "~0.1.0",
"karma-ng-scenario": "~0.1.0",
"karma-requirejs": "~0.2.1",
"karma-script-launcher": "~0.1.0",
"load-grunt-tasks": "~0.2.0",
"phantomjs": "^2.1.7",
"phantomjs-prebuilt": "^2.1.14",
"protractor": "~0.18.1",
"requirejs": "~2.1.10",
"time-grunt": "~0.2.1"
 },
 "engines": {
"node": ">=0.8.0"
},
 "scripts": {
   "test": "grunt test"
}
}

现在当我运行npm install时出现以下错误:

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: 
fsevents@github:pipobscure/fseve
nts#7dcdf9fa3f8956610fd6f69f72c67bace2de7138 
(node_modules\chokidar\node_modules
\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for 
fsevents@
0.2.1: wanted {"os":"darwin","arch":"any"} (current: 
{"os":"win32","arch":"x64"}
)
npm WARN karma@0.10.10 requires a peer of karma-coffee-preprocessor@~0.1.0 
but none was installed.
npm WARN karma@0.10.10 requires a peer of karma-firefox-launcher@~0.1.0 but 
none was installed.
npm WARN karma@0.10.10 requires a peer of karma-phantomjs-launcher@~0.1.0 
but none was installed.

运行npm install会安装package.json中提到的所有依赖项,还是需要分别安装jasmine-core和karma-jasmine?

2 个答案:

答案 0 :(得分:0)

npm install安装package.json中指定的所有依赖项。您应该在node_modules文件夹中找到它。

答案 1 :(得分:0)

这是你的业力版本的问题。 在package.json文件中包含以下行而不是当前的业力行。

"karma": "^0.11.14"

另外,重要的是要注意,如果你使用的是karma-chrome-launcher 你需要在你的package.json文件中包含它,因为新版本的karma没有附带它。

所以也包括以下一行。

"karma-chrome-launcher": "^0.1.2"

我希望这能解决你的问题。