Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在本地运行karma时,phantomjs赢了';开始_Phantomjs_Karma Runner_Ubuntu 14.04 - Fatal编程技术网

在本地运行karma时,phantomjs赢了';开始

在本地运行karma时,phantomjs赢了';开始,phantomjs,karma-runner,ubuntu-14.04,Phantomjs,Karma Runner,Ubuntu 14.04,当在我的Ubuntu虚拟机上从本地安装的项目运行Karma时,Karma不会运行,因为PhantomJS无法启动 版本信息: PhantomJS(也在本地安装):1.9.16 业力:0.12.31 karma phantomjs启动器:0.1.4 Ubuntu 14.04.2 LTS 节点0.10.25 同样的脚本在我的Mac OS上运行得很好(我在运行之前删除了karma的全局安装,它仍然有效) 在Ubuntu上,如果我直接通过./node_modules/phantomjs/bin/ph

当在我的Ubuntu虚拟机上从本地安装的项目运行Karma时,Karma不会运行,因为PhantomJS无法启动

版本信息:

  • PhantomJS(也在本地安装):1.9.16
  • 业力:0.12.31
  • karma phantomjs启动器:0.1.4
  • Ubuntu 14.04.2 LTS
  • 节点0.10.25
同样的脚本在我的Mac OS上运行得很好(我在运行之前删除了karma的全局安装,它仍然有效)

在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
我似乎还能够在端口9876手动启动节点服务器,因此这可能也不是问题所在

任何帮助都将不胜感激。谢谢

----更新


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

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

我也面临同样的问题,对我有效的解决方案是运行
sudo yum install fontconfig

命令必须在正确的位置执行,但这是可行的。

我遇到了同样的问题,我在package.json文件中将karma phantomjs启动器更改为“^1.0.0”。
更改后,Phantomjs开始工作

我面临着类似的问题,但与我之前的评论一致的是
退出代码1
,这个问题(我在评论中提到)在Ubuntu 14.04中为我解决了,从项目中删除了
节点模块
目录(其他人使用Macbook签入了该目录). 我再次运行了
npm安装
,并重新创建了
node\u modules
目录。我们还将
node\u modules
目录添加到了
.gitignore
,以避免将来出现此问题。有趣的是,如果有机会,我必须再试一次。我在Mac主机上使用了Vagrant,这就可以解释了。我将在稍后测试时发布结果。如果它与Mac Os Sierra相关,请将版本更改为1.0.0或更高版本。在再次运行npm安装之前,不要忘记删除
node_模块中的
karma phantomjs launcher
。。。