[Grunt] jit-grunt: Plugin for the "karma" task not found. 오류




증상

Grunt 를 이용하여 test 수행 시 아래와 같이 보여지며 정상적으로 작동이 되지 않았다.



lucifer@lucifer-Vostro-V13:/source/angular/todo$ grunt test
Running "clean:server" (clean) task
>> 1 path cleaned.

Running "wiredep:app" (wiredep) task

Running "wiredep:test" (wiredep) task

Running "concurrent:test" (concurrent) task

    Running "copy:styles" (copy) task
    Copied 1 file
   
    Done, without errors.
   
   
    Execution Time (2016-03-01 06:43:37 UTC)
    loading tasks               435ms  ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 88%
    loading grunt-contrib-copy   33ms  ▇▇▇ 7%
    copy:styles                  26ms  ▇▇ 5%
    Total 495ms
   
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-01 06:43:35 UTC)
loading tasks                  435ms  ▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 14%
wiredep:app                    343ms  ▇▇▇▇▇▇▇▇▇▇▇ 11%
wiredep:test                    40ms  ▇▇ 1%
concurrent:test                 1.1s  ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 36%
loading grunt-postcss          182ms  ▇▇▇▇▇▇ 6%
postcss:server                 318ms  ▇▇▇▇▇▇▇▇▇▇▇ 10%
postcss:dist                   429ms  ▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 13%
loading grunt-contrib-connect  199ms  ▇▇▇▇▇▇▇ 6%
connect:test                    65ms  ▇▇▇ 2%
Total 3.2s

lucifer@lucifer-Vostro-V13:/source/angular/todo$






해결방법

아래와 같은 명령어로 관련된 프로그램들을 설치해주니 정상적으로 되었다.
(윈도우에서는 앞의 sudo 명령어를 빼고 입력하면 된다.)


$ sudo npm install grunt-karma karma karma-phantomjs-launcher karma-jasmine jasmine-core phantomjs-prebuilt --save-dev






lucifer@lucifer-Vostro-V13:/source/angular/todo$ grunt test
Running "clean:server" (clean) task
>> 1 path cleaned.

Running "wiredep:app" (wiredep) task

Running "wiredep:test" (wiredep) task

Running "concurrent:test" (concurrent) task
  
    Running "copy:styles" (copy) task
    Copied 1 file
  
    Done, without errors.
  
  
    Execution Time (2016-03-01 07:23:32 UTC)
    loading tasks               434ms  ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 88%
    loading grunt-contrib-copy   33ms  ▇▇▇ 7%
    copy:styles                  26ms  ▇▇ 5%
    Total 494ms
  
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

Running "karma:unit" (karma) task
01 03 2016 16:23:36.280:WARN [watcher]: Pattern "/source/angular/todo/test/mock/**/*.js" does not match any file.
01 03 2016 16:23:36.522:INFO [karma]: Karma v0.13.21 server started at http://localhost:8080/
01 03 2016 16:23:36.557:INFO [launcher]: Starting browser PhantomJS
01 03 2016 16:23:38.553:INFO [PhantomJS 2.1.1 (Linux 0.0.0)]: Connected on socket /#cHONTCxkMI-hJGL_AAAA with id 34685169
PhantomJS 2.1.1 (Linux 0.0.0) Controller: TodoCtrl should attach a list of awesomeThings to the scope FAILED
    TypeError: undefined is not an object (evaluating 'TodoCtrl.awesomeThings.length') in /source/angular/todo/test/spec/controllers/todo.js (line 21)
    /source/angular/todo/test/spec/controllers/todo.js:21:34
PhantomJS 2.1.1 (Linux 0.0.0): Executed 3 of 3 (1 FAILED) (0.049 secs / 0.041 secs)
Warning: Task "karma:unit" failed. Use --force to continue.

Aborted due to warnings.


Execution Time (2016-03-01 07:23:31 UTC)
loading tasks                  432ms  ▇▇▇▇▇ 4%
wiredep:app                    326ms  ▇▇▇▇ 3%
concurrent:test                 1.1s  ▇▇▇▇▇▇▇▇▇▇▇ 10%
loading grunt-postcss          180ms  ▇▇ 2%
postcss:server                 311ms  ▇▇▇ 3%
loading grunt-contrib-connect  190ms  ▇▇ 2%
loading grunt-karma             1.8s  ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 16%
karma:unit                      6.2s  ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 58%
Total 10.7s

lucifer@lucifer-Vostro-V13:/source/angular/todo$





PS.
이상하게도 이것저것 해봤지만 정상적으로 되지 않아서 재부팅도 해보고 이것저것 설치를 하다가 마지막에 해당 명령어를 입력하여 설치 후 테스트 해보니 정상적으로 되었다.



lucifer@lucifer-Vostro-V13:~$ sudo npm install grunt-karma --save-dev
grunt-karma@0.12.1 node_modules/grunt-karma
└── lodash@3.10.1
lucifer@lucifer-Vostro-V13:~$






참조
https://github.com/yeoman/generator-angular/issues/1230#issuecomment-167261260
http://stackoverflow.com/questions/17313157/generator-angular-task-karma-not-found-when-calling-grunt-test



댓글