问题描述
运行命令 grunt
时,我收到以下警告:
运行karma:unit(karma)任务
警告:没有framework:jasmine的提供者! (解决:framework:jasmine)使用--force继续。
有人知道如何解决这个问题吗?
创建一个新项目后,yeoman角度生成器(yo angular)发生同样的错误。
我在packages.json的devDependencies中添加了karma-jasmine,并再次运行npm install。
npm install karma-jasmine - -save-dev
这解决了错误信息No provider forframework:jasmine!
我还必须在devDependencies中添加一个业力浏览器启动器,因为我得到了没有安装启动器的消息(请参阅)。
npm install karma-safari-launcher --save-dev
在我的动作之后,我的packages.json看起来像这样:
{
name:test1,
ver sion:0.0.0,
dependencies:{},
devDependencies:{
grunt:〜0.4.1,
grunt -autoprefixer:〜0.4.0,
grunt-bower-install:〜0.7.0,
grunt-concurrent:〜0.4.1,
grunt-contrib-clean:〜0.5.0,
grunt-contrib-coffee:〜0.7.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-imagemin:〜0.3.0,
grunt-contrib-jshint:〜0.7.1,
grunt-contrib-uglify: 〜0.2.0,
grunt-contrib-watch:〜0.5.2,
grunt-google-cdn:〜0.2.0,
grunt更新:〜0.5.4,
grunt-ngmin:〜0.0.2,
grunt-rev:〜0.1.0,
grunt-svgmin:〜0.2.0,
grunt-usemin:〜2.0.0,
jshint-stylish:〜0.1.3,
负载克runt-tasks:〜0.2.0,
time-grunt:〜0.2.1,
karma-ng-scenario:^ 0.1.0,
grunt-karma:^ 0.8.0,
karma:^ 0.12.0,
karma-jasmine:〜0.2.2,
karma-safari-launcher:〜0.1.1,
karma-ng-html2js-preprocessor:^ 0.1.0
},
engines: {
node:> = 0.8.0
},
scripts:{
test:grunt test
}
}
我将karma.conf中的以下行更改为karma-e2e.conf以使用karma-safari-launcher:
浏览器:['Safari'],
我希望这也适用于您。
When I run the command
grunt
I get the following warning:Running "karma:unit" (karma) task Warning: No provider for "framework:jasmine"! (Resolving: framework:jasmine) Use --force to continue.
Does anybody know how to resolve this issue?
解决方案I had the same error after creating a new project the yeoman angular generator (yo angular).
The solution for me was adding "karma-jasmine" to the devDependencies in packages.json and running "npm install" again.
npm install karma-jasmine --save-dev
This solved the error message "No provider for "framework:jasmine"!"
I also had to add a karma browser launcher to the devDependencies, as I got the message that no launcher was installed (see http://karma-runner.github.io/0.10/config/browsers.html).
npm install karma-safari-launcher --save-dev
My packages.json looked like this after my action:
{ "name": "test1", "version": "0.0.0", "dependencies": {}, "devDependencies": { "grunt": "~0.4.1", "grunt-autoprefixer": "~0.4.0", "grunt-bower-install": "~0.7.0", "grunt-concurrent": "~0.4.1", "grunt-contrib-clean": "~0.5.0", "grunt-contrib-coffee": "~0.7.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-imagemin": "~0.3.0", "grunt-contrib-jshint": "~0.7.1", "grunt-contrib-uglify": "~0.2.0", "grunt-contrib-watch": "~0.5.2", "grunt-google-cdn": "~0.2.0", "grunt-newer": "~0.5.4", "grunt-ngmin": "~0.0.2", "grunt-rev": "~0.1.0", "grunt-svgmin": "~0.2.0", "grunt-usemin": "~2.0.0", "jshint-stylish": "~0.1.3", "load-grunt-tasks": "~0.2.0", "time-grunt": "~0.2.1", "karma-ng-scenario": "^0.1.0", "grunt-karma": "^0.8.0", "karma": "^0.12.0", "karma-jasmine": "~0.2.2", "karma-safari-launcher": "~0.1.1", "karma-ng-html2js-preprocessor": "^0.1.0" }, "engines": { "node": ">=0.8.0" }, "scripts": { "test": "grunt test" } }
I changed the following line in karma.conf en karma-e2e.conf to use the karma-safari-launcher:
browsers: ['Safari'],
I hope this will work for you, too.
这篇关于没有提供“框架:茉莉花”! (解决:框架:茉莉花)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!