【问题标题】:Installing PhantomJS in CentOS在 CentOS 中安装 PhantomJS
【发布时间】:2017-12-22 12:42:39
【问题描述】:

我正在尝试在 Centos 中安装 PhantomJS。这些是我遵循的步骤。

yum install freetype fontconfig
cd ~
wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-1.9.7-linux-i686.tar.bz2
bunzip2 phantomjs*.tar.bz2
tar xvf phantomjs*.tar
cp phantomjs*/bin/phantomjs /usr/bin/phantomjs

我收到以下错误。

phantomjs: error while loading shared libraries: libfontconfig.so.1: cannot open shared object file: No such file or directory

任何人都可以发光。我已经安装了 fontconfig。

【问题讨论】:

    标签: centos phantomjs installation


    【解决方案1】:

    哇,那个版本太古老了,你需要它有什么特殊原因吗?

    无论如何,a basic Google search 你的错误suggests installing 一个额外的包:

    libfontconfig
    

    【讨论】:

    • 我按照一些博客的步骤进行操作。你有安装最新版本的步骤吗?谢谢!
    • 没有可用于 centos 的软件包 libfontconfig
    • 可能是 libfontconfig1 或类似的,您可以将错误与您的 CentOs 版本一起谷歌。
    【解决方案2】:

    没有可用于 centos 的软件包 libfontconfig。 您可以尝试手动安装:

    wget http://www.freedesktop.org/software/fontconfig/release/fontconfig-2.11.0.tar.gz
    tar -zxvf fontconfig-2.11.0.tar.gz
    cd fontconfig-2.11.0
    ./configure -prefix=/usr
    make
    # move the file into /usr/lib manually (don't trust 'make install' on a production box)
    sudo mv ./src/.libs/libfontconfig.so.1.2.0 /usr/lib/
    # and setup the libfontconfig.so.1 symlink
    cd /usr/lib
    sudo ln -s libfontconfig.so.1.2.0 libfontconfig.so.1
    

    【讨论】:

      【解决方案3】:

      以下内容在 Amazon Linux 2018.03 上对我有用。 (虽然不完全相同,但 Amazon Linux 类似于 RedHat / Centos)

      yum install fontconfig freetype freetype-devel fontconfig-devel libstdc++
      

      【讨论】:

        【解决方案4】:

        在支持 ES6 的 CentOS 上安装 phantomJS 时遇到困难的任何人。 请按照以下步骤操作。

        在 CentOS 上安装 Wine (Wine 让您可以在 linux 发行版上运行 windows .exe 应用程序)
        https://phoenixnap.com/kb/how-to-install-wine-on-centos

        下载这个包
        https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.5.0-beta2-windows.zip

        wine64 phantomjs.exe script.js
        

        就这么简单。享受吧。

        我已经用 CentOS 6 和 7 测试过它

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 2014-05-31
          • 1970-01-01
          • 1970-01-01
          • 2016-08-27
          • 2013-09-02
          • 2016-02-03
          • 2010-11-30
          • 2021-06-23
          相关资源
          最近更新 更多