一:在服務器遷移之后發現,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!