Search code examples
phantomjskarma-runnermocha-phantomjskarma-mochakarma-coverage

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


My package.json looks like this..

"karma-phantomjs-launcher": "^0.1.4",
"karma-safari-launcher": "^0.1.1",
"karma-sinon-chai": "~0.2.0",
"karma-spec-reporter": "~0.0.16",
"mocha": "~1.20.1"

my npm version is 2.2.0

whay am I getting this when I run karma test - karma start my.conf.js


Solution

  • 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