我正在Gitlab CI中设置用于selenium自动测试的CI作业,但由于该问题,测试失败。
019-09-27T11:03:17.404Z INFO @wdio/cli:Launcher:运行onPrepare钩子/builds/shauryav/test-react-ci-cd/node_modules/chromedriver/lib/chromedriver/chromedriver:加载共享库时出错:libnss3.so:无法打开共享对象文件:没有这样的文件或目录
我已经尝试了许多解决方案,如安装软件包“@wdio/cli”:“^5.13.2”,“webdriverio”:“^5.13.2”但什么都不起作用。在本文中,我没有使用任何docker设置
/builds/shauryav/test-react-ci-cd/node_modules/chromedriver/lib/chromedriver/chromedriver: error while loading shared libraries: libnss3.so: cannot open shared object file: No such file or directory
2019-09-27T11:03:27.415Z ERROR @wdio/cli:utils: A service failed in the 'onPrepare' hook
Error: timeout
at Timeout.timeoutFunc (/builds/shauryav/test-react-ci-cd/node_modules/tcp-port-used/index.js:204:25)
at listOnTimeout (internal/timers.js:531:17)
at processTimers (internal/timers.js:475:7)```
3条答案
按热度按时间ercv8c1e1#
试试这些命令
apt install libnss
apt install libnss3-dev libgdk-pixbuf2.0-dev libgtk-3-dev libxss-dev
如果上面的命令不起作用,那么就使用下面的命令
sudo apt install libgconf-2-4 libatk1.0-0 libatk-bridge2.0-0 libgdk-pixbuf2.0-0 libgtk-3-0 libgbm-dev libnss3-dev libxss-dev
yqhsw0fo2#
当您看到这种情况时,这意味着您的操作系统缺少预期的低级库。
要解决这个问题(Debian/Ubuntu示例),
1.确保您的软件包索引是最新的。
1.在包管理器的包中搜索丢失的包
1.从搜索结果中确定合适的候选人
1.安装候选人
1.再次运行您的命令
如果错误消息消失=>成功
如果错误消息更改=>为新的错误消息重复
如果错误消息没有改变=>您安装的库没有您需要的文件,因此请卸载并尝试其他库
参见
man apt-get
14ifxucb3#
您需要满足库依赖项才能在无头模式下运行chrome:
sudo apt-get update && sudo apt-get install -y gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libnss3 lsb-release xdg-utils wget ca-certificates
更多