Joel's Thoughts

Issue With Phantomjs: Phantomjs binary not found...

October 28, 2016

I have this Ecommerce MEAN Stack project and I’m running client side unit tests through Karma. Karma is calling PhantomJs to perform some headless browser tests.

I installed PhantomJs through npm install command and this is how my package.json looks like:

    "phantomjs": "^2.1.7",

However, running my unit test through Karma stops and displays an error - “Phantomjs binary not found…….”.

Further investigation and I found out that PhantomJs is not properly installed during the npm install process. So my solution is to manually install PhantomJs using its included install.js script.

Here’s the command from the root of my project:

  cd node_modules\phantomjs
  node install.js  

Running node install.js above re-installs PhantomJs and will download required dependencies. Once I ran Karma again, errors were gone and my client side unit test went through.









  • About
  • Search
  • Resume
  • Powered by Jekyll using the Trio theme