Ubuntu 安装PhantomJS:经历了构建过程,如何安装?

Ubuntu 安装PhantomJS:经历了构建过程,如何安装?,ubuntu,installation,phantomjs,ubuntu-14.04,Ubuntu,Installation,Phantomjs,Ubuntu 14.04,编辑:我不认为链接问题回答了我的问题。这是总结 当我这样做的时候 > ./phantomjs/bin/phantomjs phantomjs> # this is the phantomjs shell so it is working 但当我这么做的时候 > ln -s phantomjs/bin/phantomjs /usr/local/bin/phantomjs > phantomjs -v <ubuntu not installed message>

编辑:我不认为链接问题回答了我的问题。这是总结

当我这样做的时候

> ./phantomjs/bin/phantomjs
phantomjs> # this is the phantomjs shell so it is working
但当我这么做的时候

> ln -s phantomjs/bin/phantomjs /usr/local/bin/phantomjs
> phantomjs -v
<ubuntu not installed message>
然而,当我使用phantomjs-v时,我发现我仍然没有它

在许多网站上,我找到了安装它的替代方法(无需从源代码构建,如使用npm或某些软件包管理器),但在很长的
/build.sh
完成后,我没有找到该做什么。有人能帮忙吗

我尝试了评论中建议的解决方案。它不起作用。详情如下

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# 
更多

root@crawler:~/myname#ls-l phantomjs/bin/ 总数43960
-rwxr-xr-x 1根根45005494 Dec 24 08:28 phantomjs解决了这个问题。对于像我这样的人,在未来,而不是

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

cp  phantomjs/bin/phantomjs /usr/local/bin/phantomjs
我真的不明白为什么,但出于某种原因或其他一些深层次的符号链接正在发生。全过程:

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

在我的例子中,软链接必须使用绝对路径。 替换


可能重复:您必须将生成的可执行文件放入路径中,或链接到路径中的目录。@ArtjomB。但这个答案使用了不同的安装方法,而不是构建。sh@ArtjomB. 所以我应该只做
ln-s phantomjs/bin/phantomjs/usr/local/bin/phantomjs
我做了上面的事情,我
phantomjs-v
仍然告诉我它没有安装打开一个新的shell并重试,检查
/usr/local/bin
是否在
$PATH
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
ln -s phantomjs/bin/phantomjs /usr/local/bin/phantomjs
ln -s /home/user/src/phantomjs/bin/phantomjs /usr/local/bin/phantomjs