how to run phantomjs on heroku?

2019-02-04 18:00发布

问题:

I am trying to run phantomjs on the heroku cedar stack.

I am using a phantomjs buildpack for heroku https://github.com/stomita/heroku-buildpack-phantomjs. However I followed the instructions but still cannot make it work. When I run the command heroku run bash and type phantomjs --version it says phantomjs: command not found

I read things about LD_LIBRARY_PATH that needs to be set to "/usr/local/lib:/usr/lib:/lib:/app/vendor/phantomjs/lib", this is what i did but without success.

Is there something that i am missing ? Where does the buildpack install the phantomjs binary exactly ? Is there a way to know the path where the binary is ?

I am using ruby 1.9.2

Thanks a lot for your help.

EDIT: To be more precise, i want to combine ruby and phantomjs, so i am using this custom buildpack: https://github.com/ddollar/heroku-buildpack-multi, but when i push to heroku i get "Heroku push rejected, failed to compile Multipack app"

回答1:

Download the 64-bit linux binary file from phantomjs.org here http://phantomjs.org/download.html

Create a bin/ directory in your app if you do not already have one and place the binary file there. You should then be able to test if you can run it with "heroku run 'phantomjs'" or "heroku run 'bin/phantomjs'"