You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Windows11下Ubuntu WSL2执行npm run test时Xvfb依赖缺失错误的解决求助

Windows11下Ubuntu WSL2执行npm run test时Xvfb依赖缺失错误的解决求助

大家好,我在Windows11的Ubuntu WSL2环境里运行npm run test命令时遇到了Cypress的依赖问题,具体报错如下:

account-management-fullstack-level-2@1.0.0 test
cypress run

It looks like this is your first time using Cypress: 9.7.0
Your system is missing the dependency: Xvfb
Install Xvfb and run Cypress again.
Error: spawn Xvfb ENOENT
Platform: linux-x64 (Ubuntu - 20.04) Cypress Version: 9.7.0

我尝试安装相关依赖包,执行了这条命令:

sudo apt-get install libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2 libxtst6 xauth xvfb

但安装过程中出现了依赖冲突的问题,输出如下:

[sudo] password for ron:
Reading package lists... Done
Building dependency tree
Reading state information... Done
libgtk2.0-0 is already the newest version (2.24.32-4ubuntu4).
libgtk2.0-0 set to manually installed.
libxss1 is already the newest version (1:1.2.3-1).
libxss1 set to manually installed.
libxtst6 is already the newest version (2:1.2.3-1).
xauth is already the newest version (1:1.1-0ubuntu1).
xauth set to manually installed.
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
libgl1-mesa-dri : Depends: libglapi-mesa (= 20.2.6-0ubuntu0.20.04.1) but 21.2.6-0ubuntu0.1~20.04.2 is to be installed
libqt5svg5 : Depends: libqt5widgets5 (>= 5.12.8+dfsg~) but it is not going to be installed
xvfb : Depends: libgl1 but it is not going to be installed
E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.

现在我不确定该怎么解决这个依赖冲突问题,有没有大佬能给点思路呀?

备注:内容来源于stack exchange,提问作者nicku

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.23 08:04:13