phantomjs执行常见错误


一:在服务器迁移之后发现,phantomjs截图没有执行,但是服务也没有报错(确认phantomjs相关路径没有问题)

二:测试

  1、编写一个测试脚本test.js

console.log('Hello, world!');
phantom.exit();

  2、使用phantomjs执行测试脚本,出现如下错误

[root@VM_4_4_centos opt]# /opt/phantomjs/bin/phantomjs /opt/test.js 
/opt/phantomjs/bin/phantomjs: error while loading shared libraries: libfontconfig.so.1: cannot open shared object file: No such file or directory

三:解决方法

yum -y install freetype

yum -y install fontconfig

  然后执行测试脚本显示正常

[root@VM_4_4_centos opt]# /opt/phantomjs/bin/phantomjs /opt/test.js 
Hello, world!

 

  


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM