JavaScript 如何安装 phantomjs 2.0.0 版本 ?求助

panxiubin · 2016年11月22日 · 最后由 panxiubin 回复于 2016年11月23日 · 7368 次阅读

我用的 mac 系统是:10.12.1 macOS Sierra 现在 phantomjs 版本已经更新到了 2.1.1,但由于之前他们做项目的时候用的是 2.0.0 版本,于是我需要在电脑上安装 2.0.0 版本的 phantomjs。 我尝试过的几个方式:

  1. 直接用 brew 来安装 brew install phantomjs(这时候下载的是最新版 2.1.1 的不能用,在系统中会出现报错)
  2. phantomjs-2.0.0-macosx.zip 下载,也不能用,输入 phantomjs -v 确认版本的时候出现 [1] 48674 killed phantomjs -v

  3. 看到这个“官网提供的 2.0.0 版本在 mac 10.0 中会报 phantomjs killed:9 错误,解决办法下载补丁版本 https://github.com/eugene1g/phantomjs/releases/download/2.0.0-bin/phantomjs-2.0.0-macosx.zip

running phantomjs on osx yosemite, download the build/fix found at:

https://github.com/eugene1g/phantomjs/releases

original issue:

https://github.com/ariya/phantomjs/issues/12928

于是下载补丁版本,依然出现如上的错误。我出现的不是 killed:9,而是 48674 killed。

  1. 于是决定下载源代码在电脑上进行编译。源代码地址是这个 phantomjs-2.0.0-source.zip 1 cd /usr/local/bin 2 axel https://npm.taobao.org/mirrors/phantomjs/phantomjs-2.0.0-source.zip #下载源码 3 unzip phantomjs-2.0.0-source.zip #解压源码 4 cd phantomjs-2.0.0 5 ./build.sh #开始编译

但是在开始编译的时候出现了 bug,“Xcode not set up properly. You may need to confirm the license agreement by running /usr/bin/xcodebuild without arguments”

看到这篇文章 Qt does not work since Xcode 8 于是修改了这里

Replace:

isEmpty($$list($$system("/usr/bin/xcrun -find xcrun 2>/dev/null")))
With:

isEmpty($$list($$system("/usr/bin/xcrun -find xcodebuild 2>/dev/null")))

再次运行,出现了 bug“clang: error: linker command failed with exit code 1 (use -v to see invocation)”

想请教一下大家,如何才能在系统 10.12.1 macOS Sierra 上安装 phantomjs2.0.0?谢谢!

I think it's clear enough. Just follow the error messages and you'll find your way.

@novtopro thanks very much. I try running /usr/bin/xcodebuild , but it doesn't work. and I follow this http://stackoverflow.com/questions/33728905/qt-creator-project-error-xcode-not-set-up-properly-you-may-need-to-confirm-t change my code, it doesn't work too.

@panxiubin 不是 running /usr/bin/xcodebuild 而是直接 /usr/bin/xcodebuild,你没发现下面在提示:

command not found: running

@nightire 非常感谢。 我的 xcode 已经是最新版本了【Version 8.1 (8B62)】 我要怎么修改呢?感谢!

@novtopro @nightire I'm completely new to compiler source code, so please forgive me if the answer is obvious.

2.1.1 版本的超级好安装~~~再次感觉被折腾的够呛

最后想出个了个办法,把 2.1.1 版本里的 bin 文件,换成 2.0.0 版本的 bin 文件,其它地方都不变,于是出现了一下的情况

2.0.0 版本的 bin 从这里下载,因为这里下载下来的文件只有 bin 和 examples 两个文件

需要 登录 后方可回复, 如果你还没有账号请 注册新账号