找不到插件“karma-jasmine”

时间:2015-12-31 10:14:05

标签: angularjs

当我运行karma start我遇到此错误时

31 12 2015 09:59:40.923:WARN [plugin]: Cannot find plugin "karma-jasmine".
  Did you forget to install it ?
  npm install karma-jasmine --save-dev
31 12 2015 09:59:40.934:WARN [plugin]: Cannot find plugin "karma-phantomjs-launcher".
  Did you forget to install it ?
  npm install karma-phantomjs-launcher --save-dev
/home/ubuntu/.nvm/versions/node/v4.2.1/lib/node_modules/karma/node_modules/di/lib/injector.js:9
      throw error('No provider for "' + name + '"!');
      ^

Error: No provider for "framework:jasmine"! (Resolving: framework:jasmine)

显然它抱怨,因为它没有karma-jasmin 我运行这个命令

sudo npm install karma-jasmine --save-dev

确保它已安装,作为回应它会给我这条消息

npm WARN package.json taksi_client@1.0.0 No description
npm WARN package.json taksi_client@1.0.0 No repository field.
npm WARN package.json taksi_client@1.0.0 No README data
karma-jasmine@0.3.6 node_modules/karma-jasmine.

我的意思是,在我看来,已经安装了karma-jasmin。 然后我试了

sudo npm install karma-phantomjs-launcher --save-dev

问题是,我希望在这两个命令之后我可以运行karma start 但它再次抱怨,cannot find plugin "karma-jasmin"

更新: 我在我的package.json

中有这个
"devDependencies": {
    "karma": "^0.13.15",
    "karma-chrome-launcher": "^0.2.2",
    "karma-jasmine": "^0.3.6",
    "karma-phantomjs-launcher": "^0.2.2"
  }

1 个答案:

答案 0 :(得分:22)

在我看来,解决方案是在

npm install -g karma-cli