generator-angular
generator-angular copied to clipboard
jit-grunt: Plugin for the "karma" task not found.
#1230
I had find some issues; but it didn't work for me;
I had install all the karma dependencies
npm install grunt-karma karma karma-phantomjs-launcher karma-jasmine jasmine-core phantomjs-prebuilt --save-dev
and the `generator karma``
npm install -g generator-karma
and this is my package.json
{
"name": "angulart",
"private": true,
"devDependencies": {
"autoprefixer-core": "^5.2.1",
"grunt": "^0.4.5",
"grunt-angular-templates": "^0.5.7",
"grunt-concurrent": "^1.0.0",
"grunt-contrib-clean": "^0.6.0",
"grunt-contrib-compass": "^1.0.0",
"grunt-contrib-concat": "^0.5.0",
"grunt-contrib-connect": "^0.9.0",
"grunt-contrib-copy": "^0.7.0",
"grunt-contrib-cssmin": "^0.12.0",
"grunt-contrib-htmlmin": "^0.4.0",
"grunt-contrib-imagemin": "^1.0.0",
"grunt-contrib-jshint": "^0.11.0",
"grunt-contrib-uglify": "^0.7.0",
"grunt-contrib-watch": "^0.6.1",
"grunt-filerev": "^2.1.2",
"grunt-google-cdn": "^0.4.3",
"grunt-jscs": "^1.8.0",
"grunt-newer": "^1.1.0",
"grunt-ng-annotate": "^0.9.2",
"grunt-postcss": "^0.5.5",
"grunt-svgmin": "^2.0.0",
"grunt-usemin": "^3.0.0",
"grunt-wiredep": "^2.0.0",
"jasmine-core": "^2.4.1",
"jit-grunt": "^0.9.1",
"jshint-stylish": "^1.0.0",
"karma": "^0.13.22",
"karma-jasmine": "^0.3.8",
"phantomjs-prebuilt": "^2.1.7",
"time-grunt": "^1.0.0"
},
"engines": {
"node": ">=0.10.0"
},
"scripts": {
"test": "karma start test/karma.conf.js"
}
}
after I init a new Project
yo angular
...
npm install
bower install
when I runt grunt test
occur an error
[axetroy@axetroy-pc angular-t]$ grunt test
Running "clean:server" (clean) task
>> 0 paths cleaned.
Running "wiredep:app" (wiredep) task
Running "wiredep:test" (wiredep) task
Running "wiredep:sass" (wiredep) task
Running "concurrent:test" (concurrent) task
Running "compass:dist" (compass) task
directory .tmp/styles
write .tmp/styles/main.css (0.042s)
Running "compass:server" (compass) task
Done, without errors.
Execution Time (2016-03-27 14:54:35 UTC)
loading tasks 749ms ▇▇▇▇▇ 14%
loading grunt-contrib-compass 403ms ▇▇▇ 8%
compass:dist 3s ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 57%
compass:server 1.2s ▇▇▇▇▇▇▇ 22%
Total 5.4s
Running "postcss:server" (postcss) task
>> 1 processed stylesheet created.
Running "postcss:dist" (postcss) task
>> 1 processed stylesheet created.
Running "connect:test" (connect) task
Started connect web server on http://localhost:9001
jit-grunt: Plugin for the "karma" task not found.
If you have installed the plugin already, please setting the static mapping.
See https://github.com/shootaroo/jit-grunt#static-mappings
Warning: Task "karma" failed. Use --force to continue.
Aborted due to warnings.
Execution Time (2016-03-27 14:54:31 UTC)
loading tasks 1.6s ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 17%
wiredep:app 576ms ▇▇▇▇▇▇ 6%
concurrent:test 6.5s ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 67%
loading grunt-postcss 144ms ▇▇ 1%
postcss:server 318ms ▇▇▇ 3%
loading grunt-contrib-connect 225ms ▇▇ 2%
Total 9.7s
about env
[axetroy@axetroy-pc angular-t]$ node -v
v5.6.0
[axetroy@axetroy-pc angular-t]$ npm -v
3.8.3
[axetroy@axetroy-pc angular-t]$ yo --version
1.7.0
[axetroy@axetroy-pc angular-t]$
I’m having the same issue. Tried scaffolding out a project with yo angular
several times but get the same problem each time.
@axetroy, is that package.json
file from before or after you ran the manual npm install ... --save-dev
command?
Keep in mind, the Grunt file calls tasks that are provided by Grunt plugins, many of which are wrappers for external libraries. In this case, the karma
task in Gruntfile.js
calls a task provided by grunt-karma
, which wraps the functionality provided by the karma
Node package.
I'd suggest you try running npm install grunt-karma --save-dev
and then trying your test
task again.
@ZaLiTHkA , i run yo
and selete Angular
to init the project
it run npm install
by this generator
after i find the command grunt test
fail,then I run the command npm install ... --save-dev
manually wanna to fixed it
grunt test
fail again but npm runt test
success
that mean karma has work
should I load this Plugin manually?
like
require('karma')(grunt);
There's no need to manually require
each plugin, that's already taken care of by jit-grunt
.
Your last message is somewhat unclear as to the steps you took, so let me put it this way instead.. Try the following steps:
- run
yo angular my-project
(unless you've already done this) - after files have been generated, check the
devDependencies
list in yourpackage.json
file forgrunt-karma
- if it's not there, run
npm install grunt-karma --save-dev
- check your
package.json
file again (you should seegrunt-karma
with a version string of^0.12.2
) - try run
grunt test
again
Just for clarification, if npm run test
works but grunt test
does not, then you're definitely missing the Grunt wrapper for the Karma test suite. If you look at the scripts
configuration in your package.json
file and the karma
task in your Gruntfile.js
file, you'll see both options for running tests use the exact same configuration file (test/karma.conf.js
); the only difference is that one command uses the Grunt plugin while the other does not.
i can confirm this is still a bug that you will run into with a current (today) attempt at going through Step 8 of http://yeoman.io/codelab/index.html
As @ZaLiTHkA wrote: it's all about the missing grunt-karma
in the dev-dependencies or in other words, it's fixed by a manual npm install grunt-karma --save-dev
at the moment.
Please fix.