jbl*_*ley 33 installation phantomjs casperjs
我正在尝试在我的Mac(Yosemite)上安装PhantomJS.
我做了以下事情:
npm install phantomjs
Run Code Online (Sandbox Code Playgroud)
然后我做了:
npm install phantomjs-prebuilt
Run Code Online (Sandbox Code Playgroud)
这两个都出现在我的node_modules中.但是当我试着奔跑时,phantomjs --version我得到了
-bash: phantomjs: command not found
Run Code Online (Sandbox Code Playgroud)
还尝试从下载网站安装二进制文件,但没有.我错过了什么?最终目标是使用casperjs,但目前casper正在询问
Fatal: [Errno 2] No such file or directory; did you install phantomjs?
Run Code Online (Sandbox Code Playgroud)
我以为我做了......?
Vla*_*dtn 47
如果您使用的是Homebrew,您可以输入:
brew tap homebrew/cask
brew cask install phantomjs
Run Code Online (Sandbox Code Playgroud)
小智 29
God*_*ude 17
您需要将phantomjs二进制文件添加到PATH中.您可以通过修改环境变量或通过将二进制文件符号化来实现此目的/usr/local/bin
例如,如果要对二进制文件进行符号链接:
cd $HOME
curl -O https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-macosx.zip
ln -s $HOME/phantomjs-2.1.1-macosx/bin/phantomjs /usr/bin/phantomjs
Run Code Online (Sandbox Code Playgroud)
或者如果要修改PATH环境变量:
cd $HOME
curl -O https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-macosx.zip
Run Code Online (Sandbox Code Playgroud)
并将此行添加到此文件~/.bash_profile::
export PATH=$HOME/phantomjs-2.1.1-macosx/bin:$PATH
Run Code Online (Sandbox Code Playgroud)
然后运行:
source ~/.bash_profile
Run Code Online (Sandbox Code Playgroud)
cgn*_*utt 16
接受的答案已过时.在Mac上,使用Homebrew,键入:
brew tap homebrew/cask
brew cask install phantomjs
Run Code Online (Sandbox Code Playgroud)
某些MacOS版本可能不需要第一步.
| 归档时间: |
|
| 查看次数: |
30852 次 |
| 最近记录: |