Issues running casperjs with phantomjs#2.0.0 on Mac (Yosemite)

拥有回忆 提交于 2019-12-19 01:47:53

问题


I'm trying to run CasperJS having PhantomJS#2.0.0 on a Mac(Yosemite). When trying to run CasperJS I´m getting the following message:

"CasperJS needs PhantomJS v1.x

  /usr/local/Cellar/casperjs/1.1-beta3/libexec/bin/bootstrap.js:91 in __die"

How can I make it run? Has anyone got it working?


回答1:


Currently there is no newer version than 1.1-beta3 released which contains this check.

The simplest fix would be to open the bin/bootstrap.js file and remove these lines or replacing the lines that are currently in the master branch:

(function (version) {
    // required version check
    if (version.major === 1) {
        if (version.minor < 8) {
            return __die('CasperJS needs at least PhantomJS v1.8 or later.');
        }
        if (version.minor === 8 && version.patch < 1) {
            return __die('CasperJS needs at least PhantomJS v1.8.1 or later.');
        }
    } else if (version.major === 2) {
        console.log("Warning PhantomJS v2.0 not yet released. There will not be any official support for any bugs until stable version is released!");
    }
    else return __die('CasperJS needs PhantomJS v1.x or v2.x');
})(phantom.version);

The other option would be to install CasperJS from git.




回答2:


Modifying /usr/local/Cellar/casperjs/1.1-beta3/libexec/bin/bootstrap.js does not work for me. I tried but some other problems remain (Could not get casperPath and version correctly).

This issue is already fixed in master branch. Installing from git would solve this problem.

Try

> git clone git://github.com/n1k0/casperjs.git
> cd casperjs
> ln -sf `pwd`/bin/casperjs /usr/local/bin/casperjs

It fix my casperjs perfectly.




回答3:


I was having the same problem. Replacing the phantomJS executable in /usr/local/bin with that from version 1.9.8 did the trick for me.



来源:https://stackoverflow.com/questions/28656768/issues-running-casperjs-with-phantomjs2-0-0-on-mac-yosemite

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!