【问题标题】:Installing PhantomJS: went through build process, how to install?安装 PhantomJS:经历了构建过程,如何安装?
【发布时间】:2014-12-24 13:37:43
【问题描述】:

编辑:我认为链接问题不能解决我的问题。这是摘要

当我这样做时

> ./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>

我经历了官网提到的构建过程:

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

但是,当我做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 root root 45005494 Dec 24 08:28 phantomjs

【问题讨论】:

  • How can I setup & run PhantomJS on Ubuntu? 特别是this answer 的可能重复项:您必须将生成的可执行文件放在路径中或链接到路径中的目录。
  • @ArtjomB。但该答案使用不同的安装方法,而不是 build.sh
  • @ArtjomB。所以我应该这样做ln -s phantomjs/bin/phantomjs /usr/local/bin/phantomjs
  • 我做了上面的,我phantomjs -v 仍然告诉我它没有安装
  • 打开一个新的shell再试一次,检查/usr/local/bin是否在$PATH

标签: ubuntu installation phantomjs ubuntu-14.04


【解决方案1】:

解决了。对于任何像我一样被困在未来的人,而不是

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

【讨论】:

    【解决方案2】:

    就我而言,软链接必须使用绝对路径。 替换

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

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

    【讨论】:

      猜你喜欢
      • 2014-05-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-06-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多