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

HelloWorld picture HelloWorld · Mar 15, 2014 · Viewed 43.8k times · Source

I have run on my windows console:

npm install -g yo grunt-cli bower

npm install -g generator-angular

yo angular

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)

Then in the console I read I can also use --force so I tried it: grunt --force

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 serve now worked and it started my browser with the starting app.

So what was --force doing that the 'Error: No provider for "framework:jasmine"! (Resolving: framework:jasmine)' is gone ?

When I do grunt in the webstrom IDE I get again:

Warning: No provider for "framework:jasmine"! (Resolving: framework:jasmine) Use --force to continue.

So this problem is not solved.

Answer

grant picture grant · Mar 24, 2014

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".

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

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

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