Phantomjs: Exit Code 126 -- cannot execute binary

Created on 25 Sep 2013  路  8Comments  路  Source: ariya/phantomjs

Hey all,

I'm getting a strange issue when trying to run phantomJS in my workflow on a CentOS system.

Here is the error it's reporting:

Running "qunit:all" (qunit) task
Testing http://localhost:8000/tests.html
Running PhantomJS...ERROR
>> /home/jenkins/jenkins/workspace/nick_node_te/web-client/client/node_modules/grunt-contrib-qunit/node_modules/grunt-lib-phantomjs/node_modules/phantomjs/lib/phantom/bin/phantomjs: /home/jenkins/jenkins/workspace/nick_node_te/web-client/client/node_modules/grunt-contrib-qunit/node_modules/grunt-lib-phantomjs/node_modules/phantomjs/lib/phantom/bin/phantomjs: cannot execute binary file 0 [ '/home/jenkins/jenkins/workspace/nick_node_te/web-client/client/node_modules/grunt-contrib-qunit/node_modules/grunt-lib-phantomjs/node_modules/phantomjs/lib/phantom/bin/phantomjs: /home/jenkins/jenkins/workspace/nick_node_te/web-client/client/node_modules/grunt-contrib-qunit/node_modules/grunt-lib-phantomjs/node_modules/phantomjs/lib/phantom/bin/phantomjs: cannot execute binary file' ]
Warning: PhantomJS exited unexpectedly with exit code 126. Use --force to continue.

I can't seem to find any good documentation on this type of crash. Is this usual and/or worthy of a bug report?

Most helpful comment

Okay, here were the issues:

  1. I needed to run npm install on the CentOS server itself.
  2. I needed to install fontconfig and truetype (I think that was the name) to allow PhantomJS to run.

Closing. Thanks for the help with this!

All 8 comments

It's not a crash at all, [grunt-lib-phantomjs](https://github.com/gruntjs/grunt-lib-phantomjs] is just failing to execute the phantomjs binary because the Obvious/phantomjs wrapper module for Node is failing to update it with executable permissions after downloading it.

This comes up somewhat frequently and usually gets blamed on the unzipping library that Obvious/phantomjs uses. Examples:

  • Obvious/phantomjs#11
  • Obvious/phantomjs#12
  • Obvious/phantomjs#13
  • Obvious/phantomjs#73
  • Obvious/phantomjs#102
  • Obvious/phantomjs#103

Any which way, you will need to take it up with Obvious/phantomjs, or else get grunt-lib-phantomjs to use a newer version of Obvious/phantomjs that may contain a fix for this.

So, does this have to do with my not running 'npm install' before this? Are the permissions not set during the unzipping process?

Thanks for the help too by the way, I'm just a bit confused. Thanks!

Well, you must have done an npm install at least once to get all that stuff installed since the paths are clearly there.

The easy one-time fix is to just do

chmod +x /home/jenkins/jenkins/workspace/nick_node_te/web-client/client/node_modules/grunt-contrib-qunit/node_modules/grunt-lib-phantomjs/node_modules/phantomjs/lib/phantom/bin/phantomjs

I did run it initially, then committed the modules into the repository, which are then being pushed by source control into this environment.

I just tried the command and then ran the process, but i'm still getting the same error :( -- any other tips? Thanks again for helping with this!

For reference here are my permissions:

 -rwxr-x--x. 1 root root 11308856 Sep 26 12:39 phantomjs

But i still get the error. Is this fixable?

In addition, in case any one is interested, here's a link to the question on SO - http://stackoverflow.com/questions/19013918/phantomjs-crash-exit-code-126

Okay, here were the issues:

  1. I needed to run npm install on the CentOS server itself.
  2. I needed to install fontconfig and truetype (I think that was the name) to allow PhantomJS to run.

Closing. Thanks for the help with this!

I'm facing the same issue in Windows environment. I'm using Visual Studio IDE and I'm getting this error after installing a latter version of the xtensa compiler dependencies.

Can anyone help me out??

Thanks in Advance!!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dhilipsiva picture dhilipsiva  路  4Comments

yisibl picture yisibl  路  5Comments

Sayalic0 picture Sayalic0  路  5Comments

Snowlav picture Snowlav  路  3Comments

machadolab picture machadolab  路  5Comments