错误:没有“framework:jasmine”的提供者! (解决:框架:茉莉花) [英] Error: No provider for "framework:jasmine"! (Resolving: framework:jasmine)
问题描述
我在我的Windows操作系统上运行:
I have run on my windows console:
npm install -g yo grunt-cli bower
npm install -g generator-angular
yo angular
然后我用webstorm开始我的项目并右键单击项目浏览器中的karma.conf.js文件,其中我有菜单项Run karma.conf.js并启动karma runner。然后我得到他的例外:
Then I started my project with webstorm and did right click on the karma.conf.js file in the project explorer where I have the menu item 'Run karma.conf.js' and start the karma runner. Then I get his exception:
...\app\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)
然后在控制台中我读到我也可以使用--force so我试过了:grunt --force
Then in the console I read I can also use --force so I tried it: grunt --force
花了一些时间但似乎没有更多的错误。哎为什么--force安装提供程序???这是在CMD中测试的。
It took some time but there seemed to be no more errors. Heck why does --force install a provider ??? THIS was TESTED in the CMD.
grunt服务现在正常工作,它启动了我的浏览器启动应用程序。
grunt serve now worked and it started my browser with the starting app.
那么什么是--force做'错误:没有提供者框架:茉莉花! (解决:框架:jasmine)'消失了吗?
当我在webstrom IDE中咕噜咕噜时,我又得到了:
When I do grunt in the webstrom IDE I get again:
警告:没有framework:jasmine的提供者! (解决:框架:jasmine)使用--force继续。
Warning: No provider for "framework:jasmine"! (Resolving: framework:jasmine) Use --force to continue.
所以这个问题没有解决。
So this problem is not solved.
推荐答案
Grunt --force有效,因为你告诉它绕过业力测试。请注意,如果你运行grunt --force,它仍会说完成,但有警告。
Grunt --force works because you tell it to bypass the karma tests. Notice if you run grunt --force, it'll still say "Done, but with warnings".
修复:
添加karma-jasmine和karma-chrome-launcher(或者你使用的任何启动器)到packages.json中的devDependencies并再次运行npm install。
To fix: add "karma-jasmine" and "karma-chrome-launcher" (or whatever launcher you use) to the devDependencies in packages.json and run npm install again.
npm install karma-jasmine --save-dev
npm install karma-chrome-launcher --save-dev
这将在项目的package.json文件中保存karma-jasmine和karma-chrome-launcher。然后可以通过运行来安装包:
This will save karma-jasmine and karma-chrome-launcher in your project's package.json file. The packages can then be installed by running:
npm install
资料来源:没有提供者;框架:茉莉" ;! (解决:框架:茉莉花)
这篇关于错误:没有“framework:jasmine”的提供者! (解决:框架:茉莉花)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!