How to install phantomjs on Ubuntu Linux

Phantomjs on Ubuntu linux can be installed using apt-get or node npm. It can also be downloaded from phantomjs site. We’ll use npm to install phantomjs in this tutorial. Here are the steps to install phantomjs on Ubuntu Linux.

  1. First install node and npm on Ubuntu if not already installed.
  2. Get info about phantomjs package

    $ npm info phantomjs
    { name: 'phantomjs',
      description: 'Headless WebKit with JS API',
      'dist-tags': { latest: '2.1.3', alpha: '2.0.0-alpha' },
  3. Install phantomjs using npm in global mode

    $ sudo npm install -g phantomjs
    $ npm ls -g | grep phantomjs
    ├─┬ phantomjs@2.1.3
  4. Check if phantomjs is working

    $ phantomjs --version
  5. Check where is phantomjs installed

    $ which phantomjs
    $ ls -l /usr/bin/phantomjs
    lrwxrwxrwx 1 root root 43 Jan 23 08:23 /usr/bin/phantomjs -> ../lib/node_modules/phantomjs/bin/phantomjs
Share this article: share on Google+ share on facebook share on linkedin tweet this submit to reddit


Click here to write/view comments