PhantomJS安装
ubuntu下直接apt-get install phantomjs
安装完之后运行测试phantomjs --version
如果出现以下报错:
QStandardPaths: wrong ownership on runtime directory /run/user/1000, 1000 instead of 0
No protocol specified
QXcbConnection: Could not connect to display :0
PhantomJS has crashed. Please read the bug reporting guide at
<http://phantomjs.org/bug-reporting.html> and file a bug report.
已放弃 (核心已转储)
那么按以下方法可以正常运行
#在/usr/bin/phantomjs的合适位置加上以下设置代码:
export QT_QPA_PLATFORM=offscreen
export QT_QPA_FONTDIR=/usr/share/fonts