Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot install phantomJS in Karma

WARN [config]: config.configure() is deprecated, please use config.set() instead.
WARN [plugin]: Cannot find plugin "karma-phantomjs".
  Did you forget to install it ?
  npm install karma-phantomjs --save-dev
INFO [karma]: Karma v0.10.2 server started at http://localhost:9018/
WARN [launcher]: Can not load "PhantomJS", it is not registered!
  Perhaps you are missing some plugin?

Getting this error. When running npm install karma-phantomjs --save-dev I get an error.

npm ERR! 404 'karma-phantomjs' is not in the npm registry.

I installed karma-phantomjs-launcher --save-dev but i still get an error when running grunt watch.

Anyone else run into this issue?

like image 992
Marty Lavender Avatar asked Aug 30 '13 02:08

Marty Lavender


3 Answers

npm install karma-jasmine --save-dev

npm install karma-phantomjs-launcher --save-dev

Then add the following line to karma.config.js

plugins : ['karma-jasmine', 'karma-phantomjs-launcher']

like image 111
Ben Gao Avatar answered Oct 21 '22 21:10

Ben Gao


I got tripped up by this today running

  • karma: 0.13.7
  • karma-phantomjs-launcher: 1.0.0

What isn't very obvious is that the launcher has a dependency on:

  • phantomjs-prebuilt

So if you, install this locally everything should run fine, eg:

npm install phantomjs-prebuilt --save-dev

like image 16
Iain Hunter Avatar answered Oct 21 '22 22:10

Iain Hunter


After some research I realized that I needed to run:

npm install -g karma@canary phantomjs karma-phantomjs-launcher

Once I ran that I went back into my karma-unit.tpl.js file and instead of karma-phantomjs, I changed this to karma-phantomjs-launcher.

Now when I execute a command like grunt build, I get no error regarding phantomJS

like image 4
Marty Lavender Avatar answered Oct 21 '22 21:10

Marty Lavender