在本地运行业力时,phantomjs将无法启动

ccn*_*kes 6 phantomjs karma-runner ubuntu-14.04

在我的Ubuntu VM上的项目上从本地安装运行Karma时,Karma将无法运行,因为PhantomJS无法启动.

版本信息:

  • PhantomJS(也在本地安装):1.9.16
  • 业力:0.12.31
  • karma-phantomjs-launcher:0.1.4
  • Ubuntu 14.04.2 LTS
  • 节点0.10.25

同样的脚本在我的Mac OS上运行得很好(我在运行它之前删除了全局的业力安装,但它仍然有效).

在Ubuntu上,如果我直接通过./node_modules/phantomjs/bin/phantomjs启动phantomjs,它就会正常启动.

这是shell输出:

> ./node_modules/karma/bin/karma start test/karma.conf.js

DEBUG [config]: autoWatch set to false, because of singleRun
DEBUG [plugin]: Loading karma-* from /srv/detectiveui/node_modules
DEBUG [plugin]: Loading plugin /srv/detectiveui/node_modules/karma-jasmine.
DEBUG [plugin]: Loading plugin /srv/detectiveui/node_modules/karma-phantomjs-launcher.
DEBUG [plugin]: Loading plugin /srv/detectiveui/node_modules/karma-spec-reporter.
INFO [karma]: Karma v0.12.31 server started at http://localhost:9876/
INFO [launcher]: Starting browser PhantomJS
DEBUG [temp-dir]: Creating temp dir at /tmp/karma-42625347
DEBUG [launcher]: /srv/detectiveui/node_modules/karma-phantomjs-launcher/node_modules/phantomjs/lib/phantom/bin/phantomjs /tmp/karma-42625347/capture.js
DEBUG [launcher]: Process PhantomJS exited with code 2
ERROR [launcher]: Cannot start PhantomJS

DEBUG [temp-dir]: Cleaning temp dir /tmp/karma-42625347
INFO [launcher]: Trying to start PhantomJS again (1/2).
DEBUG [launcher]: Restarting PhantomJS
DEBUG [temp-dir]: Creating temp dir at /tmp/karma-42625347
DEBUG [launcher]: /srv/detectiveui/node_modules/karma-phantomjs-launcher/node_modules/phantomjs/lib/phantom/bin/phantomjs /tmp/karma-42625347/capture.js /tmp/karma-42625347/capture.js
DEBUG [watcher]: Resolved files:
    #...List of my files here that look correct...
DEBUG [launcher]: Process PhantomJS exited with code 2
ERROR [launcher]: Cannot start PhantomJS

DEBUG [temp-dir]: Cleaning temp dir /tmp/karma-42625347
INFO [launcher]: Trying to start PhantomJS again (2/2).
DEBUG [launcher]: Restarting PhantomJS
DEBUG [temp-dir]: Creating temp dir at /tmp/karma-42625347
DEBUG [launcher]: /srv/detectiveui/node_modules/karma-phantomjs-launcher/node_modules/phantomjs/lib/phantom/bin/phantomjs /tmp/karma-42625347/capture.js /tmp/karma-42625347/capture.js /tmp/karma-42625347/capture.js
DEBUG [launcher]: Process PhantomJS exited with code 2
ERROR [launcher]: Cannot start PhantomJS

DEBUG [temp-dir]: Cleaning temp dir /tmp/karma-42625347
ERROR [launcher]: PhantomJS failed 2 times (cannot start). Giving up.

DEBUG [karma]: Run complete, exiting.
DEBUG [launcher]: Disconnecting all browsers
Run Code Online (Sandbox Code Playgroud)

我似乎也能够在端口9876手动启动节点服务器,所以这可能也不是问题.

任何帮助将不胜感激.谢谢!

---- UPDATE

我创建了一个新的Ubuntu环境并再次测试了相同的东西并得到了同样的错误.

Spl*_*tar 1

libfontconfig通过安装sudo apt-get install libfontconfig可以解决这个问题。