简体   繁体   English

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

[英]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. 但是,当我执行phantomjs -v我发现我仍然没有它。

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. 在许多网站上,我已经找到了安装它的替代方法(没有从源代码进行构建,例如使用npm或某些软件包管理器),但是在很长的./build.sh完成之后却没有找到./build.sh方法。 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 root @ crawler:〜/ myname#ls -l phantomjs / bin /总计43960 -rwxr-xr-x 1根root 45005494 Dec 24 08:28 phantomjs

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

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM