question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot start PhantomJS

See original GitHub issue

Hello, this seems to be somewhat related to issue #558. However I’m new to all this (npm, grunt, karma) and I’m not really sure of the identity of the problem.

When I grunt karma:unit I get this sad result

Running "karma:unit" (karma) task
INFO [karma]: Karma v0.12.28 server started at http://localhost:8080/
INFO [launcher]: Starting browser PhantomJS
ERROR [launcher]: Cannot start PhantomJS
    Error: spawn EACCES
INFO [launcher]: Trying to start PhantomJS again (1/2).
ERROR [launcher]: Cannot start PhantomJS
    Error: spawn EACCES
INFO [launcher]: Trying to start PhantomJS again (2/2).
ERROR [launcher]: Cannot start PhantomJS
    Error: spawn EACCES
ERROR [launcher]: PhantomJS failed 2 times (cannot start). Giving up.
Warning: Task "karma:unit" failed. Use --force to continue.
Aborted due to warnings.

With my limited understanding I’ve tried installing and reinstalling (global and/or not) phantomjs but it didn’t work out.

I’m on Ubuntu 12.04 karma@0.12.28 node@0.10.34 phantomjs@1.9.12

However, when I $ phantomjs --version, I get 1.9.8. which is odd. Checking on the phantomjs website seems to confirm the latests release is phantomjs 1.9.8.

$ npm remove phantomjs -g
unbuild phantomjs@1.9.12
$ npm remove phantomjs
unbuild phantomjs@1.9.12
$  phantomjs --version
bash: ~/.npm-packages/bin/phantomjs: No such file or directory

So I don’t think there’s another installation that karma could refer to. At this point, when I launch grunt karma:unit it accordingly say that phantomjs isn’t there.

Then I reinstalled phantomjs

$ npm install phantomjs

> phantomjs@1.9.12 install ~/mytodo/node_modules/phantomjs
> node install.js

Downloading https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-1.9.8-linux-x86_64.tar.bz2
Saving to /tmp/phantomjs/phantomjs-1.9.8-linux-x86_64.tar.bz2
Receiving...
  [======================================--] 95% 0.0s
Received 12854K total.
Extracting tar contents (via spawned process)
Removing /media/Fermi/workspace/mytodo/node_modules/phantomjs/lib/phantom
Copying extracted folder /tmp/phantomjs/phantomjs-1.9.8-linux-x86_64.tar.bz2-extract-1418991182513/phantomjs-1.9.8-linux-x86_64 -> ~/mytodo/node_modules/phantomjs/lib/phantom
Removing /tmp/phantomjs/phantomjs-1.9.8-linux-x86_64.tar.bz2-extract-1418991182513
Writing location.js file
Done. Phantomjs binary available at ~/mytodo/node_modules/phantomjs/lib/phantom/bin/phantomjs
phantomjs@1.9.12 node_modules/phantomjs
├── which@1.0.8
├── progress@1.1.8
├── rimraf@2.2.8
├── ncp@1.0.1
├── kew@0.4.0
├── adm-zip@0.4.4
├── request-progress@0.3.1 (throttleit@0.0.2)
├── mkdirp@0.5.0 (minimist@0.0.8)
├── npmconf@2.0.9 (uid-number@0.0.5, inherits@2.0.1, osenv@0.1.0, ini@1.3.2, once@1.3.1, semver@4.1.0, nopt@3.0.1, config-chain@1.1.8)
└── request@2.42.0 (caseless@0.6.0, json-stringify-safe@5.0.0, aws-sign2@0.5.0, forever-agent@0.5.2, stringstream@0.0.4, oauth-sign@0.4.0, tunnel-agent@0.4.0, qs@1.2.2, node-uuid@1.4.2, mime-types@1.0.2, tough-cookie@0.12.1, http-signature@0.10.0, form-data@0.1.4, bl@0.9.3, hawk@1.1.1)

Still, karma complains Cannot start PhantomJS Error: spawn EACCES.

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:21 (6 by maintainers)

github_iconTop GitHub Comments

17reactions
egelandcommented, Jun 30, 2015

Just wanted to note, as I had a similar issue today - phantomjs on Ubuntu needs the libfontconfig package (and/or the libfontconfig-dev package - I installed both) or it won’t start…

5reactions
jangarajcommented, Aug 8, 2015

RHEL/CentOS solution:

yum install -y fontconfig freetype-devel
Read more comments on GitHub >

github_iconTop Results From Across the Web

phantomjs cannot start up - Stack Overflow
It uses PHANTOMJS_BIN to run phantomjs, so I solved it like this: ... As long as you can run "phantomjs" from the command...
Read more >
Troubleshooting - PhantomJS
Start PhantomJS on the command line with the --remote-debugger-port=9000 option. Open http://127.0.0.1:9000/ in a Webkit-based web browser. There should be a ...
Read more >
How can I debug a Cannot start PhantomJS message when ...
I just cloned the repo and it works fine. It looks like your tests were executed just fine and then, when killing the...
Read more >
Start up phantomjs on localhost, and a random port
Throws and error if phantom cannot be found, or cannot be started. It works with a timeout of five seconds. run_phantomjs(debugLevel = c("INFO ......
Read more >
karma-phantomjs-launcher - npm
A Karma plugin. Launcher for PhantomJS.. Latest version: 1.0.4, last published: 6 years ago. Start using karma-phantomjs-launcher in your ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found