如何在Heroku上使用PhantomJS 2.5.0 Beta [英] How to use PhantomJS 2.5.0 Beta on Heroku
问题描述
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...
-
heroku buildpacks:add --index 1 https://github.com/heroku/heroku-buildpack-apt
-
heroku buildpacks:add https://github.com/lookitsatravis/heroku-buildpack-phantomjs.git
-
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
- 提交
Aptfile
,推送到Heroku应用.
heroku buildpacks:add --index 1 https://github.com/heroku/heroku-buildpack-apt
heroku buildpacks:add https://github.com/lookitsatravis/heroku-buildpack-phantomjs.git
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
- Commit
Aptfile
, push to Heroku app.
更多信息
-
依赖项::您必须使用 Heroku Apt buildpack 来安装缺少的依赖项.首先,您需要将buildpack添加到您的应用中:
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
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 asxenial
, 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屋!