Ber*_*ues 21 javascript windows-subsystem-for-linux cypress yarn-v2
我正在尝试使用 Ubuntu 在 WSL 上运行 cypress,这就是我得到的结果:
$ cypress run
[29023:1018/155130.159647:ERROR:bus.cc(392)] Failed to connect to the bus: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory
[29023:1018/155130.162020:ERROR:bus.cc(392)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
[29023:1018/155130.162068:ERROR:bus.cc(392)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
[29211:1018/155130.193707:ERROR:gpu_init.cc(441)] Passthrough is not supported, GL is swiftshader
...
[29023:1018/155132.292604:ERROR:bus.cc(392)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
Timed out waiting for the browser to connect. Retrying...
[29023:1018/155232.249036:ERROR:bus.cc(392)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
Timed out waiting for the browser to connect. Retrying again...
[29023:1018/155332.249372:ERROR:bus.cc(392)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
(-2) loading 'http://localhost:3000/__/#/tests/integration/simple.spec.ts'
Error: (-2) loading 'http://localhost:3000/__/#/tests/integration/simple.spec.ts'
at rejectAndCleanup (electron/js2c/browser_init.js:161:7486)
at Object.failListener (electron/js2c/browser_init.js:161:7699)
at Object.emit (events.js:376:20)
Run Code Online (Sandbox Code Playgroud)
我找不到任何相关主题,有什么帮助吗?
Not*_*1ds 16
Cypress 需要能够运行其 GUI。根据您的 Windows 版本,您可能需要一些额外的配置才能在 WSL 中运行 GUI 应用程序:
对于所有 Windows 版本,请确保安装所需的依赖项:
apt-get install libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2 libxtst6 xauth xvfb
Run Code Online (Sandbox Code Playgroud)
这可能已为您完成,具体取决于您安装 Cypress 的方式。我使用了Cypress 文档中的npm
说明。
Windows 11 默认包含 WSLg 功能,该功能允许您直接在 Windows 上运行 GUI 应用程序。如果您从 Windows 10 升级到 Windows 11,请运行wsl --update
WSLg 以确保您拥有最新的 WSL 版本。
另外,如果您尝试在旧版本上运行 X 服务器(如下一个建议),请确保删除DISPLAY
启动文件中的任何手动配置(例如~/.bashrc
,等等)。
对于 Windows 10,您将需要进行一些额外的配置。实际上有两种方法可以做到这一点,但对于超级用户来说这是一个更好的主题(因为它与编程没有直接关系),所以我将向您指出这个超级用户问题以获取一些详细信息。任何一个答案都可以。虽然我偏爱我的解决方案,但大多数人选择运行第三方 X 服务器,如 harrymc 的答案所示。
为了确保赛普拉斯运行不需要任何“隐藏技巧”,我可以确认我能够成功./node_modules/.bin/cypress open
使用赛普拉斯指令和xrdp
超级用户答案中的技术。
小智 9
我们的 Azure Cypress 管道中也开始出现此错误。然而,当我们迁移到 Cypress 8.6.0 时,它开始发生,这是当我们被问到时的最新版本的 Cypress。恢复到 8.4.0 解决了我们的问题。
我在查看各种帖子时运气不佳,有时处于 VPN 后面,而公司防火墙似乎是一个主要问题。
我经常会收到如下错误:
[14874:0408/102328.150664:ERROR:bus.cc(392)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
[14874:0408/102328.150745:ERROR:bus.cc(392)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
[15032:0408/102328.255402:ERROR:gpu_init.cc(453)] Passthrough is not supported, GL is swiftshader, ANGLE is
[14874:0408/102328.321306:ERROR:bus.cc(392)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
[14874:0408/102328.331513:ERROR:bus.cc(392)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
[14874:0408/102402.013363:ERROR:connection.cc(66)] X connection error received.
[15032:0408/102402.014034:ERROR:connection.cc(66)] X connection error received.
[15032:0408/102402.014064:ERROR:connection.cc(66)] X connection error received.
Run Code Online (Sandbox Code Playgroud)
我发现问题是 WSL2 需要将显示器设置为 Windows 主机的 IP 地址。这听起来很奇怪,但如果您不熟悉 WSL2,它有自己的 IP 地址和子网;因此你需要告诉它使用不属于它自己的显示器的IP。
我在这里记录了完整的过程:https://gist.github.com/pjobson/6b9fb926c59f58aa73d4efa10fe13654
我的步骤是:
小智 5
赛普拉斯故障排除页面表明您可以忽略这些错误。我现在不确定这是错误还是转移注意力。
https://docs.cypress.io/guides/references/troubleshooting#Run-the-Cypress-app-by-itself
注意:详细的 Electron 日志记录可能会显示警告,但仍允许 Cypress 正常工作。例如,尽管出现以下可怕的输出,Cypress Test Runner仍正常打开:[475:0617/150421.326986:ERROR:bus.cc(395)] 无法连接到总线:无法连接到套接字/var/run/dbus/ system_bus_socket:没有这样的文件或目录[475:0617/150425.061526:错误:bus.cc(395)]无法连接到总线:无法解析服务器地址:未知地址类型(有效类型的示例是“tcp”和UNIX“unix”)[475:0617/150425.079819:错误:bus.cc(395)]无法连接到总线:无法解析服务器地址:未知地址类型(有效类型的示例是“tcp”,在UNIX上“ UNIX”)
我在超时的 cypress 运行中遇到此错误,但在成功运行时也出现此错误。这让我相信我可以忽略它。
归档时间: |
|
查看次数: |
25915 次 |
最近记录: |