user1989488
user1989488

Reputation: 123

I am getting issue phantomjs and karma

I am facing issue while running grunt, it throwing me following issue:

ERROR [launcher]: PhantomJS2 failed 2 times (timeout). Giving up.

DEBUG [karma]: Run complete, exiting.

DEBUG [launcher]: Disconnecting all browsers

Warning: Task "karma:continuous" failed. Use --force to continue.

I tried to run npm install phantomjs

Which is successful. After that i run npm install as well but again getting above issue

Upvotes: 2

Views: 1252

Answers (2)

user1989488
user1989488

Reputation: 123

I got solution for this, if we get this error so first need to check karm.conf.js file, there you have to search for key browsers and in that section you have to see whether PhantomJS2 is defined or not.It would be something like this:

browsers : [
  'PhantomJS2'
],

In my case it was there but still i was getting error, i then checked my hosts file which you can find in C:\Windows\System32\drivers\etc if you are using windows machine and i placed 127.0.0.1 localhost and there i go.... its worked for me.

Upvotes: 1

Jagrut
Jagrut

Reputation: 922

This is because you will need to run the PhantomJS standalone version for karma to connect to it.

I would suggest a better option according to my opinion, which is to use karma-phantomjs2-launcher. You can get that by: npm install --save-dev karma-phantomjs2-launcher.

Please note that it is not a stable version. If it suits your requirement, you can use karma-phantomjs-launcher, which works perfectly fine. But it does not have support for PhantomJS 2.

Upvotes: 1

Related Questions