No binary for PhantomJS browser on your platform. Please, set "PHANTOMJS_BIN" env variable
Solution 1
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
Solution 2
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
Solution 3
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.
Solution 4
I remove all my node_modules folder under my Project and run "npm install". This did fix my problem.
Solution 5
I hit this problem with [email protected], where I had also installed [email protected].
Turns out that phantomjs is deprecated, replaced with phantomjs-prebuilt.
Uninstalling both packages and reinstalling phantomjs-prebuilt fixed the problem with karma-phantomjs-launcher:
npm -g remove phantomjs phantomjs-prebuilt
npm -g install phantomjs-prebuilt
Related videos on Youtube
Sanath
Senior Frontend Engineer with 12+ years of experience in the software development industry including 7+ years of Australian experience, enabling me to improve my professional skills and gain technical competencies. I have worked extensively with Angular JS, React, VueJs, and the related front-end technology stack. My experience in NodeJs and J2EE based technologies has allowed me to gain a good technical understanding about the total application architecture and the best practices required in end to end implementation of a business solution. I am passionate about the evolving front-end technology landscape and have been working with some of the cutting-edge technologies in that domain.
Updated on July 09, 2022Comments
-
Sanath almost 2 years
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
-
MarcoL over 9 yearsThe message is pretty clear: there's no PhantomJS installed on your machine.
karma-phantomjs-launcher
should download a binary of PhantomJS and install on your machine if available: because it's not you have to manually install yourself and then add its path to the environment variables using thePHANTOMJS_BIN
. -
F Lekschas over 9 years@MarcoCI I do have the same problem and there actually is a binary of phantomjs being installed together with the
karma-phantomjs-launcher
. -
MarcoL over 9 years@Flek: then export the path of that file as shown in the answer below.
-
crowne almost 8 yearsI fixed it by removing karma-phantomjs-launcher and phantomjs and running npm install
-
-
Mike over 8 yearsThese commands initially seemed to cause more problems then solutions but I eventually worked through them.
brew upgrade nodejs
didn't work out for me, I gotError: node not installed
. But it seems that just unistalling phantomjs, cleaning npm cache, and reinstalling packages with npm cleared myNo binary for PhantomJS browser on your platform. Please, set “PHANTOMJS_BIN” env variable
error. Thank you! -
blamb almost 8 yearsexactly why i didnt want to embark on them. i physically downgraded node to cure another problem. no time for that tonite
-
thenakulchawla over 7 yearsI am able to do this for the first time, but every time I close my system and restart the app, I have to do this again. Is there a way to permanently get rid of this error?
-
ironic_ollins over 7 yearsI also ran into issues with npm after doing the upgrade...
npm install
would simply quit after a deprecation warning. Physically downloading the latest from nodejs.org fixed it for me