Install your own PhantomJS on Travis CI

On a current project, we switched our javascript driver to Poltergeist, a driver for Capybara that allows you to run your tests in a headless browser provided by PhantomJS. Happy days and green dots locally, but our build server on Travis CI had a different opinion.

Failure/Error: And I am logged in as user ""
    PhantomJS version 1.6.1 is too old. You must use at least version 1.7.0

Fortunately Travis CI has made it easy and convenient to install any software you like on the virtual machine. So until the default is bumped to the required version of PhantomJS, add the following lines to your .travis.yml and you will be off and running with Poltergeist in no time.

  - wget                                                                                                                                                             
  - tar -xf phantomjs-1.7.0-linux-i686.tar.bz2                                                                                                                                                                                                
  - sudo rm -rf /usr/local/phantomjs                                                                                                                                                                                                          
  - sudo mv phantomjs-1.7.0-linux-i686 /usr/local/phantomjs
Eric Milford


Post a Comment

(optional — will be included as a link.)
  1. I believe this web site has got some really fantastic info for everyone . “I like work it fascinates me. I can sit and look at it for hours.” by Jerome K. Jerome.

    March 17, 2013 at 13:44 PM
  2. Hi,

    I tried above , but after adding above line into travis.yml my build is stopped.

    If i removed above line then travis build is complete.

    I am able to run my test on my local environment but not on travis.

    Sujit Kumbhar
    Sujit Kumbhar
    July 10, 2015 at 2:05 AM