当我运行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"
}
答案 0 :(得分:22)
在我看来,解决方案是在
npm install -g karma-cli