How to update phantomjs 1.9.8 to phantomjs 2.1.1 on ubuntu?
Here is how I would do it if I were developing. The packages are versioned to nodejs and not ubuntu:
Use nvm
: https://github.com/creationix/nvm
touch ~/.profile
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.7/install.sh | bash
source ~/.profile
# node 6x
nvm install 6.5.0
npm install [email protected]
# node 4x
nvm install 4.5.0
nvm use 4.5.0
npm install [email protected]
# node 0.12x
nvm install 0.12
npm show phantomjs@* version
npm install [email protected]
Perhaps we are developing on 0.10, 0.12, 4.X, iojs4.x, 6.X, etc
well now we have access to choose whichever version of phantomjs:
jmunsch@ubuntu:~$ npm show phantomjs@* version
[email protected] '0.0.1'
[email protected] '0.0.2'
[email protected] '0.0.3'
[email protected] '0.0.4'
[email protected] '0.0.5'
[email protected] '0.0.6'
[email protected] '0.0.7'
[email protected] '0.0.8'
[email protected] '0.0.9'
[email protected] '0.1.0'
[email protected] '0.1.1'
[email protected] '0.2.0'
[email protected] '0.2.1'
[email protected] '0.2.2'
[email protected] '0.2.3'
[email protected] '0.2.4'
[email protected] '0.2.5'
[email protected] '0.2.6'
[email protected] '1.9.8'
[email protected] '1.9.9'
[email protected] '1.9.10'
[email protected] '1.9.11'
[email protected] '1.9.12'
[email protected] '1.9.13'
[email protected] '1.9.15'
[email protected] '1.9.16'
[email protected] '1.9.17'
[email protected] '1.9.18'
[email protected] '1.9.19'
[email protected] '2.1.1'
[email protected] '2.1.2'
[email protected] '2.1.3'
[email protected] '1.9.20'
[email protected] '2.1.7'
system-wide for deployment scenarios, etc.
Here is how using the tarball
export PHANTOM_JS_VERSION=2.1.1
wget "https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-$PHANTOM_JS_VERSION-linux-x86_64.tar.bz2"
tar xvfj "./phantomjs-$PHANTOM_JS_VERSION-linux-x86_64.tar.bz2"
ln -sf "./phantomjs-$PHANTOM_JS_VERSION-linux-x86_64/bin/phantomjs" "/usr/bin"
Tested on ubuntu 14.04, perhaps moving the folder to another place other than ./
update for 16.04:
wget may or may not work see: https://github.com/Medium/phantomjs/issues/161
# install dependencies
sudo apt-get install libfontconfig
# extract the tar file
tar xvfj "./phantomjs-$PHANTOM_JS_VERSION-linux-x86_64.tar.bz2"
# use full path
ln -sf "$(pwd)/phantomjs-$PHANTOM_JS_VERSION-linux-x86_64/bin/phantomjs" "/usr/bin"
Error
phantomjs: error while loading shared libraries: libfontconfig.so.1: cannot open shared object file: No such file or directory
Try:
sudo apt-get install libfontconfig
I just installed phantomjs 2.1.1 in ubuntu 16.04 with the following steps, which I found after a bit of googling :
sudo apt-get install nodejs
sudo apt-get install nodejs-legacy
sudo apt-get install npm
sudo npm -g install phantomjs-prebuilt