2015-12-31 67 views
3

當我運行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 [email protected] No description 
npm WARN package.json [email protected] No repository field. 
npm WARN package.json [email protected] No README data 
[email protected] 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" 
    } 

回答

20

在我看來,解決辦法是

npm install -g karma-cli 
+1

也爲我工作,非常感謝! – ZipionLive