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