taoCMS是基于php+sqlite/mysql的国内最小(100Kb左右)的功能完善、开源免费的CMS管理系统

CentOS6.4安装PhantomJS或CasperJS教程

2015-11-04

casperjsのインストール

sudo su 
cd /usr/local/src
git clone https://github.com/n1k0/casperjs.git
cd casperjs
ln -sf `pwd`/bin/casperjs /usr/local/bin/casperjs

phantomjsのインストール

cd /usr/local/src
git clone https://github.com/ariya/phantomjs.git
cd phantomjs
./build.sh

なんかエラーが出る。

TIQUE -O2 -Wall -W -fPIE  -I../../../mkspecs/linux-g++ -I. -o icu.o icu.cpp
icu.cpp:42:28: error: unicode/utypes.h: No such file or directory
icu.cpp:43:26: error: unicode/ucol.h: No such file or directory
icu.cpp:44:29: error: unicode/ustring.h: No such file or directory
icu.cpp: In function ‘int main(int, char**)’:
icu.cpp:48: error: ‘UErrorCode’ was not declared in this scope
icu.cpp:48: error: expected ‘;’ before ‘status’
icu.cpp:49: error: ‘UCollator’ was not declared in this scope
icu.cpp:49: error: ‘collator’ was not declared in this scope
icu.cpp:49: error: ‘status’ was not declared in this scope
icu.cpp:49: error: ‘ucol_open’ was not declared in this scope
icu.cpp:50: error: ‘U_FAILURE’ was not declared in this scope
icu.cpp:52: error: ‘ucol_close’ was not declared in this scope
gmake: *** [icu.o] Error 1
ICU disabled.
The ICU library support cannot be enabled.
 Turn on verbose messaging (-v) to /usr/local/src/phantomjs/src/qt/qtbase/configure to see the final report.
 If you believe this message is in error you may use the continue
 switch (-continue) to /usr/local/src/phantomjs/src/qt/qtbase/configure to continue.

軽く調べた感じだと、

yum install gcc gcc-c++ make git openssl-devel freetype-devel fontconfig-devel

を入れた後に1.9にcheckoutするといいらしい。

git checkout 1.9
./build.sh
bin/phantomjs -v
ln -sf `pwd`/bin/phantomjs /usr/local/bin/phantomjs

これで、

[root@localhost]/usr/local/src/phantomjs# phantomjs -v
1.9.7
[root@localhost]/usr/local/src/phantomjs# casperjs --version
1.1.0-beta3

こうなった。casperjsが動くかどうか、サンプルを実行する。

var casper = require('casper').create();

casper.start('http://casperjs.org/', function() {
    this.echo(this.getTitle());
});

casper.thenOpen('http://phantomjs.org', function() {
    this.echo(this.getTitle());
});

casper.run();
$ casperjs sample.js
CasperJS, a navigation scripting and testing utility for PhantomJS and SlimerJS
PhantomJS | PhantomJS

类别:技术文章 | 阅读:263873 | 评论:0 | 标签:centos

想收藏或者和大家分享这篇好文章→

“CentOS6.4安装PhantomJS或CasperJS教程”共有0条留言

发表评论

姓名:

邮箱:

网址:

验证码:

公告

taoCMS发布taoCMS 3.0.2(最后更新21年03月15日),请大家速速升级,欢迎大家试用和提出您宝贵的意见建议。

捐助与联系

☟请使用新浪微博联系我☟

☟在github上follow我☟

标签云