30
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?

Marty Lavender
  • 373
  • 1
  • 3
  • 8
  • @karma-phantomjs@ simply does not exist in the npm-registry, whats the error you are getting with @karma-phantomjs-launcher@? showing your gruntfile would also help... – hereandnow78 Aug 30 '13 at 07:58
  • Ive added my Gruntfile here: http://pastebin.com/gzmcRSKF karma-phantomjs-launcher installed perfectly fine. I get no error. However when I run grunt watch, I still get the error regarding phantomJS. When running phantomjs --version I get a return of 1.9.1. – Marty Lavender Aug 30 '13 at 12:34

6 Answers6

79

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']

Ben Gao
  • 1,707
  • 1
  • 13
  • 10
  • sudo npm install grunt-karma --save-dev (if not installed);see: https://stackoverflow.com/questions/17313157/generator-angular-task-karma-not-found-when-calling-grunt-test/17875685#17875685 – Ben Gao Sep 25 '14 at 21:21
  • 1
    @MartyLavender this should probably be the accepted answer ;) – Ben Feb 04 '16 at 19:06
16

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

Iain Hunter
  • 4,319
  • 1
  • 27
  • 13
4

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

Marty Lavender
  • 373
  • 1
  • 3
  • 8
2

This is an issue still open on the repo: #31

Strangely enough the following worked for my Debian based system:

apt-get install libfontconfig

How did I get into this? Reading a comment from the ticket. Hope this will help for others too :-)

Lucio
  • 4,753
  • 3
  • 48
  • 77
1

I'm running in a CentOS 7 Docker container. Had similar issue.

Had to:

yum install -y tar bzip2 freetype fontconfig

Then

npm install phantomjs --save-dev

worked without errors, which allowed

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

and that allowed

gulp test

to run without Karma or PhantomJS errors.

mauricio777
  • 1,296
  • 1
  • 15
  • 15
0

Today I had the same. I deleted all the temporary directories and, after rerun it worked. Before that i also reinstalled phantomjs but without success. It's possible that this influenced, anyway (but i think deleting the temporary directories did the job). Anyway, after deleting temporary folders you can try, if it didn't work you can reinstall phantomjs and also other stuff as other users already wrote.

fresko
  • 1,890
  • 2
  • 24
  • 25