Javascript 在 MacOs 10.11 El Captian 上安装 PhantomJS
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/33540903/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Install PhantomJS on MacOs 10.11 El Captian
提问by jfcorugedo
I can't install phantomJs in my macbook after upgrading to 10.11 (El Capitan).
升级到 10.11 (El Capitan) 后,我无法在我的 macbook 中安装 phantomJs。
Whenever I try to install it using homebrew it gives me this error:
每当我尝试使用自制软件安装它时,它都会给我这个错误:
$ brew install phantomjs
phantomjs: OS X Yosemite or older is required.
Error: An unsatisfied requirement failed this build.
回答by Thomas Ayoub
Something is broken since Xcode 7, if you have npm you can install it:
从 Xcode 7 开始有些东西坏了,如果你有 npm 你可以安装它:
npm install -g phantomjs-prebuilt
Now that the issue have been handled, you can download it.
现在问题已经解决了,你可以下载它。
回答by dwkns
Note that :
注意 :
npm install -g phantomjs
Will install v1.9.8
将会安装 v1.9.8
The latest preview version v2.0.1
works correctly on 10.11 El Captian is available as a binary download.
最新预览版v2.0.1
可在 10.11 El Captian 上正常运行,可作为二进制下载使用。
Just copy bin/phantomjs
from the download into /usr/local/bin/
(or wherever you want it) on your machine.
只需bin/phantomjs
从下载中复制到/usr/local/bin/
您的机器上(或您想要的任何地方)。
回答by Hossam Mourad
brew update
then
然后
brew install phantomjs
回答by Subhajit
Install It through Homebrew or MacPorts
通过 Homebrew 或 MacPorts 安装
brew install phantomjs
or
或者
port install phantomjs
Check the version using: phantomjs --version
使用以下命令检查版本: phantomjs --version
Which will install the latest version. Currently: 2.1.1
这将安装最新版本。目前:2.1.1
My Mac OSX version: OS X El Capitan - Version 10.11.6
我的 Mac OSX 版本: OS X El Capitan - Version 10.11.6
Thanks!
谢谢!
回答by Shi Jieming
The quickest and easiest way to install stand-alone phantomjs (tested on Mac OSX El Captian) (using brew or macports to install takes too long time since they will install the whole qt and other packages)
安装独立phantomjs的最快最简单的方法(在Mac OSX El Captian上测试过)(使用brew或macports安装需要很长时间,因为它们会安装整个qt和其他包)
download and unzip phantomjs-2.0.0-macosx.zip from http://phantomjs.org/download.html
brew install upx
upx -d phantomjs-2.0.0-macosx/bin/phantomjs
- If you did not unpack phantomjs with upx, “killed -9” error occurs PhantomJS: getting "Killed: 9" for anything I'm trying
Add phantomjs to system path in Terminal: sudo nano /etc/paths
- echo $PATH
- add your_directory/phantomjs-2.0.0-macosx/bin to the end
- Hit control-x to quit.
- Enter “Y” to save the modified buffer.
- restart terminal
- Terminal: phantomjs -v will show you the version of phantomjs if it is correctly installed
从http://phantomjs.org/download.html下载并解压 phantomjs-2.0.0-macosx.zip
酿造安装upx
upx -d phantomjs-2.0.0-macosx/bin/phantomjs
- 如果你没有用UPX解压phantomjs,“杀-9”错误PhantomJS:得到“封杀:9”的任何东西我想
将 phantomjs 添加到终端中的系统路径: sudo nano /etc/paths
- 回声 $PATH
- 将 your_directory/phantomjs-2.0.0-macosx/bin 添加到最后
- 按 control-x 退出。
- 输入“Y”保存修改后的缓冲区。
- 重启终端
- 终端:phantomjs -v 如果安装正确,将会显示 phantomjs 的版本
回答by Pandurang Patil
Latest released binary (2.1.1) for Mac has all the dependencies included in the binary. It works out of the box http://phantomjs.org/download.html
适用于 Mac 的最新发布的二进制文件 (2.1.1) 具有二进制文件中包含的所有依赖项。它开箱即用http://phantomjs.org/download.html
回答by Gcamara14
If that doesn't work try:
如果这不起作用,请尝试:
brew install npm
酿造安装npm
npm install phantom phantomjs -g