how to run phantomjs on heroku?

前端 未结 2 1273
执笔经年
执笔经年 2020-12-30 06:55

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

相关标签:
2条回答
  • 2020-12-30 07:19

    For phantomjs with javascript

    I dont know if the previous examples are actually necessary becasue although i am working with javascript it should not be different. For me all i had to do was place the phantomjs buildpack as the first on the list of installed buildpacks on your master.

    check available buildpacks

    open terminal from the app folder and type:

    heroku buildpacks
    

    This wll show the available buildpacks. eg.

    1.heroku/node.js
    
    2.https://github.com/stomita/heroku-buildpack-phantomjs.git
    

    As you can see the buildpack is second on this list. We need tomake it the first in the list.So, what i did was i removed the phantomjs builpack and then add it again but this time made sure its first on the list of all available buildpacks.

    So, to remove a buildpack, type:

    heroku buildpacks:remove https://github.com/stomita/heroku-buildpack-phantomjs.git
    

    this removes the buildpack.You can check it by typing:

    heroku buildpacks
    

    Now, it should only show,

    1.heroku/node.js
    

    Great, now we add the phantomjs buildackmaking sure its first . So on terminal type:

    heroku buildpacks:add --index 1 https://github.com/stomita/heroku-buildpack-phantomjs.git
    

    You can check if its first by typing:

    heroku buildpacks
    

    Now, it should be ,

    1.https://github.com/stomita/heroku-buildpack-phantomjs.git
    2.heroku/node.js
    

    Thats It!!

    now, on terminal , type:

    heroku run bash
    

    once you're in bash, type

    phantomjs --version
    

    The current verion of phantomjs should be shown on the terminal.

    2.1.1
    
    0 讨论(0)
  • 2020-12-30 07:31

    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'"

    0 讨论(0)
提交回复
热议问题