NPM在centOS 6.2上安装PhantomJS错误

时间:2014-07-25 07:55:37

标签: install npm phantomjs

[root@dev ~]# npm install phantomjs
npm http GET https://registry.npmjs.org/phantomjs

...

npm http 200 https://registry.npmjs.org/phantomjs/-/phantomjs-1.9.7-15.tgz
npm ERR! cb() never called!
npm ERR! not ok code 0

[root@dev ~]# node -v
v0.10.28

[root@dev ~]# npm -v
1.1.63
操作系统:centOS 6.2(最终版)

有什么问题?如何在centOS 6.2上安装phantomjs?

2 个答案:

答案 0 :(得分:2)

根据这个:http://phantomjs.org/build.html

sudo yum install gcc gcc-c++ make git openssl-devel freetype-devel fontconfig-devel
git clone git://github.com/ariya/phantomjs.git
cd phantomjs
git checkout 1.9
./build.sh

你也可以尝试预编译版本,它会快得多:

http://phantomjs.org/download.html

希望它有所帮助!

答案 1 :(得分:2)

由于版本已大大提升,您可能不会再出现此错误。但是,如果任何人在运行phantomJS的CentOS 6上有错误,我发现http://www.sameerhalai.com/blog/how-to-install-phantomjs-on-a-centos-server/有帮助并解决了我的问题。即,grunt test产生了:

-sh-4.1$ grunt test
Running "karma:unit" (karma) task
INFO [karma]: Karma v0.12.28 server started at http://localhost:9876/
INFO [launcher]: Starting browser PhantomJS
ERROR [launcher]: Cannot start PhantomJS

INFO [launcher]: Trying to start PhantomJS again (1/2).
ERROR [launcher]: Cannot start PhantomJS

INFO [launcher]: Trying to start PhantomJS again (2/2).
ERROR [launcher]: Cannot start PhantomJS

ERROR [launcher]: PhantomJS failed 2 times (cannot start). Giving up.
Warning: Task "karma:unit" failed. Use --force to continue.

Aborted due to warnings.

但是

之后
yum install -y freetype fontconfig

PhantomJS开始工作,测试通过了:)