2

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

yayu
  • 7,758
  • 17
  • 54
  • 86
  • possible duplicate of [How can I setup & run PhantomJS on Ubuntu?](http://stackoverflow.com/questions/8778513/how-can-i-setup-run-phantomjs-on-ubuntu) particularly [this answer](http://stackoverflow.com/a/21221824): you have to put the resulting executable in the path or link to a directory that is in the path. – Artjom B. Dec 24 '14 at 13:42
  • @ArtjomB. but that answer uses a different install method, not build.sh – yayu Dec 24 '14 at 13:45
  • @ArtjomB. so should I just do `ln -s phantomjs/bin/phantomjs /usr/local/bin/phantomjs` – yayu Dec 24 '14 at 13:48
  • I did the above and I `phantomjs -v` still tells me it is not installed – yayu Dec 24 '14 at 13:49
  • Open a new shell and try again, check that `/usr/local/bin` is in `$PATH` – Artjom B. Dec 24 '14 at 13:50
  • @ArtjomB. I have included some details in my question. Unfortunately its still not working – yayu Dec 24 '14 at 13:58
  • I also did a power cycle to be sure. – yayu Dec 24 '14 at 13:59
  • Have you made sure that it is an executable (`ls -l` shows an `x`)? If not, `chmod +x phantomjs/bin/phantomjs`. – Artjom B. Dec 24 '14 at 14:03
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/67624/discussion-between-yayu-and-artjom-b). – yayu Dec 24 '14 at 14:07

2 Answers2

3

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
yayu
  • 7,758
  • 17
  • 54
  • 86
0

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
Tane
  • 1