如何在Heroku上使用PhantomJS 2.5.0 Beta [英] How to use PhantomJS 2.5.0 Beta on Heroku

查看:100
本文介绍了如何在Heroku上使用PhantomJS 2.5.0 Beta的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

PhantomJS的2.5.0 beta版是可用 ,但与稳定版本不同,Linux安装有一些依赖项.我在Heroku上无法正常使用版本.我在Google小组或其他地方找不到指南或任何实际答案.我该如何进行安装?

Version 2.5.0 beta of PhantomJS is available for use, but unlike stable versions, there are some dependencies for linux installations. I'm having trouble getting a working version on Heroku. I couldn't find a guide or any real answers in the Google group or elsewhere. How can I go about getting the installation?

推荐答案

最终,我能够弄清楚!您需要做的几件事...

Ultimately, I was able to figure it out! There are a few things that you have to do...

  1. heroku buildpacks:add --index 1 https://github.com/heroku/heroku-buildpack-apt
  2. heroku buildpacks:add https://github.com/lookitsatravis/heroku-buildpack-phantomjs.git
  3. cat > Aptfile << EOL webp libhyphen0 https://mirrors.kernel.org/ubuntu/pool/main/g/gcc-5/gcc-5_5.4.1-8ubuntu1_amd64.deb https://mirrors.kernel.org/ubuntu/pool/main/g/gcc-5/libstdc++6_5.4.0-6ubuntu1~16.04.4_amd64.deb EOL
  4. 提交Aptfile,推送到Heroku应用.
  1. heroku buildpacks:add --index 1 https://github.com/heroku/heroku-buildpack-apt
  2. heroku buildpacks:add https://github.com/lookitsatravis/heroku-buildpack-phantomjs.git
  3. cat > Aptfile << EOL webp libhyphen0 https://mirrors.kernel.org/ubuntu/pool/main/g/gcc-5/gcc-5_5.4.1-8ubuntu1_amd64.deb https://mirrors.kernel.org/ubuntu/pool/main/g/gcc-5/libstdc++6_5.4.0-6ubuntu1~16.04.4_amd64.deb EOL
  4. Commit Aptfile, push to Heroku app.


更多信息

  1. 依赖项::您必须使用 Heroku Apt buildpack 来安装缺少的依赖项.首先,您需要将buildpack添加到您的应用中:

  1. Dependencies: You have to use the Heroku Apt buildpack to install the missing dependencies. First, you need to add the buildpack to your app:

heroku buildpacks:add --index 1 https://github.com/heroku/heroku-buildpack-apt

接下来,您将在项目根目录中创建一个名为Aptfile的文件.在这里,我们添加了PhantomJS 2.5.0 Beta缺少的依赖项. 2.5.0引入了webp支持,因此我们需要它.也需要libhyphen0,尽管我不确定我们如何使用它.最后,我们使用gcc-5和最新的libstdc++6.内容应如下所示:

Next, you'll create a file in your project root called Aptfile. Here's where we add the missing dependencies for PhantomJS 2.5.0 Beta. 2.5.0 introduces webp support, so we need that. libhyphen0 is required as well, though I'm not sure how it us used. Finally, we use gcc-5 and the latest libstdc++6. Contents should look like this:

webp
libhyphen0
https://mirrors.kernel.org/ubuntu/pool/main/g/gcc-5/gcc-5_5.4.1-8ubuntu1_amd64.deb
https://mirrors.kernel.org/ubuntu/pool/main/g/gcc-5/libstdc++6_5.4.0-6ubuntu1~16.04.4_amd64.deb

  1. PhantomJS:接下来,我们将获取最新版本的PhantomJS.我创建了

  1. PhantomJS: Next we grab the latest version of PhantomJS. I've created a fork of the most popular PhantomJS buildpack and updated it for use with 2.5.0 beta. 2.5.0 beta has builds for trusty as well as xenial, so the build pack will detect the Heroku stack and use the appropriate one (though the cedar-16 stack is still in beta at the time of this post). So, add it to your app:

heroku buildpacks:add https://github.com/lookitsatravis/heroku-buildpack-phantomjs.git

部署:剩下的就是部署!将Aptfile提交到您的仓库中,确保已设置构建包,然后将其推送到Heroku.

Deploy: All that's left is deployment! Commit the Aptfile to your repo, make sure the build packs are setup, and then push to Heroku.

进行了一些反复试验,但是最终我能够启动并运行它.希望这对其他人有帮助,直到最终候选人被释放为止.

Took a bit of trial and error, but ultimately I was able to get it up and running. Hope this helps others until the final candidate is released.

这篇关于如何在Heroku上使用PhantomJS 2.5.0 Beta的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆