yayu
yayu

Reputation: 8098

Installing PhantomJS: went through build process, how to install?

EDIT: I dont think linked question answers my problem. Here's the summary

When I do

> ./phantomjs/bin/phantomjs
phantomjs> # this is the phantomjs shell so it is working

but when I do

> ln -s phantomjs/bin/phantomjs /usr/local/bin/phantomjs
> phantomjs -v
<ubuntu not installed message>

I went through the build process mentioned in the official website:

sudo apt-get update
sudo apt-get install build-essential chrpath git-core libssl-dev libfontconfig1-dev libxft-dev
git clone git://github.com/ariya/phantomjs.git
cd phantomjs
git checkout 1.9
./build.sh

However, when I do phantomjs -v I find that I still don't have it.

On many websites I have found alternative methods of installing it (without building from source, like using npm or some package manager) but did not find what to do after the very long ./build.sh was complete. Can anyone help?

I tried the solution suggested in the comment. It does not work. Here are the details

root@crawler:~/myname# ln -s phantomjs/bin/phantomjs /usr/local/bin/phantomjs
root@crawler:~/myname# phantomjs -v
The program 'phantomjs' is currently not installed. You can install it by typing:
apt-get install phantomjs
root@crawler:~/myname# ls phantomjs/bin/phantomjs 
phantomjs/bin/phantomjs
root@crawler:~/myname# echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
root@crawler:~/myname# 

more

root@crawler:~/myname# ls -l phantomjs/bin/ total 43960 -rwxr-xr-x 1 root root 45005494 Dec 24 08:28 phantomjs

Upvotes: 2

Views: 1413

Answers (2)

Tane
Tane

Reputation: 1

In my case, the soft link must use absolute path. Replace

ln -s phantomjs/bin/phantomjs /usr/local/bin/phantomjs

to

ln -s /home/user/src/phantomjs/bin/phantomjs /usr/local/bin/phantomjs

Upvotes: 0

yayu
yayu

Reputation: 8098

Solved it. For anyone stuck like me, in the future, instead of

ln -s phantomjs/bin/phantomjs /usr/local/bin/phantomjs

just do

cp  phantomjs/bin/phantomjs /usr/local/bin/phantomjs

I don't really understand why, but for some reason or other some deep symlinking stuff is happening. Full process:

sudo apt-get install build-essential chrpath git-core libssl-dev libfontconfig1-dev libxft-dev
git clone git://github.com/ariya/phantomjs.git
cd phantomjs
git checkout 1.9
./build.sh
cd ..
cp  phantomjs/bin/phantomjs /usr/local/bin/phantomjs

Upvotes: 3

Related Questions