No binary for PhantomJS browser on your platform. Please, set "PHANTOMJS_BIN" env variable

This seems to be an issue with phantom js runner and phantom js versions.

https://github.com/karma-runner/karma-phantomjs-launcher/issues/31

How I fixed my issue..

   # install 
   npm install -g karma-phantomjs-launcher

   # temporary path.. set the path
   export PHANTOMJS_BIN=/usr/local/lib/node_modules/karma-phantomjs-launcher/node_modules/phantomjs/lib/phantom/bin/phantomjs

   karma start my.conf.js

I was having this issue with an older version of node, too. If you don't want to have to hard-code this environment variable, updating your version of node will solve the problem. Just do the following (OSX instructions):

npm uninstall -g phantomjs
npm cache clean -f
brew upgrade nodejs
rm -rf node_modules
npm install -g YOUR_GLOBAL_DEPENDENCIES
npm install

Edit: updated instructions to make sure there is no global phantomjs dependency


I ran into this same problem. The fix is to manually set the PHANTOMJS_BIN variable to point to the correct phantomjs path. Somehow karma launcher tries to look at the wrong path set by PHANTOMJS_BIN.

Here is what worked for me:

$ echo $PHANTOMJS_BIN

/usr/local/lib/node_modules/karma-phantomjs-launcher/node_modules/phantomjs/lib/phantom/bin/phantomjs

$ export PHANTOMJS_BIN=/usr/local/lib/node_modules/phantomjs/lib/phantom/bin/phantomjs

$ grunt test

everything is ok after that.