phantomjs在linux上的安装问题
当通过npm install phantomjs时,看起来已经安装成功,但是执行测试的时候,仍然报如下错误:
“error while loading shared libraries: libfontconfig.so.1: cannot open shared object file: No such file or directory”
这是因为phantomjs对libfontconfig存在依赖,解决办法就是安装libfontconfig这个包。在ubuntu系统上,通过apt-get install libfontconfig进行安装。安装前可以通过apt-get update命令进行源更新,否则可能会碰到这样的提示:“E: Unable to locate package libfontconfig”
参考资料
1 http://stepansuvorov.com/blog/2012/10/phantomjs-error-while-loading-shared-libraries-libfontconfig-so-1/
2 https://github.com/ariya/phantomjs/issues/10904
3 https://github.com/BetterJS/doc/issues/8
4 http://askubuntu.com/questions/378558/unable-to-locate-package-while-trying-to-install-packages-by-apt