Installing CasperJS on Ubuntu 12.10

Recently I needed to install CasperJS. It’s a testing utility written in JavaScript on top of PhantomJS so I needed to install “the phantom” first but I noticed that installing it from source would take a long time. I decided to download and install the ready-made binary package. Below are few steps that may help you install CasperJS faster. Note that the OS I’m using is Ubuntu 12.10.

Before you start, make sure you have git installed:

sudo apt-get install git

Step 1: Installing PhantomJS

– Download the latest source

– Extract the archive

tar -xvf phantomjs-1.8.2-linux-x86_64.tar.bz2

– Move the extracted folder to a proper location:

sudo mv phantomjs-1.8.2-linux-x86_64 /usr/local/src/phantomjs

– Create a symbolic link so we can just type “phantomjs” when we want to use “the phantom”

sudo ln -sf /usr/local/src/phantomjs/bin/phantomjs /usr/local/bin/phantomjs

– Check if it’s working

phantomjs --version

If you see the current PhantomJS version you can proceed with installing CasperJS.

Step 2: Installing CasperJS

– Enter a proper location to avoid moving the extracted files:

cd /usr/local/src/

– Get the source from the official git repository:

sudo git clone git://github.com/n1k0/casperjs.git

– Create symbolic link

sudo ln -sf /usr/local/src/casperjs/bin/casperjs /usr/local/bin/casperjs

– Check if it’s working

casperjs --version

Voilla, you have successfully installed CasperJS!

Advertisements

6 thoughts on “Installing CasperJS on Ubuntu 12.10

  1. Thanks :). This works for Ubuntu 13.04 too (versions have changed slightly). It’s much better than doing a sudo apt-get install phantomjs, as that will only install version 1.6. Using your method, the version of phantomjs installed is 1.9.1.

  2. Hi, i had this problem:

    /usr/local/lib/node_modules/phantomjs/lib/phantom/bin/phantomjs: error while loading shared libraries: libfontconfig.so.1: cannot open shared object file: No such file or directory

    And resolved with this command:

    sudo apt-get install libfontconfig

    For the ones who get stucked.
    Great help Anton!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s