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

如何在Jenkins中安装旧版Debian包libjpeg.so.8及解决报错

安装Playwright浏览器依赖时缺失libjpeg.so.8的问题

问题背景

部署Playwright 1.28版本时,启动浏览器出现依赖缺失错误:

16:29:17 browserType.launch:
16:29:17 ╔══════════════════════════════════════════════════════╗
16:29:17 ║ Host system is missing dependencies to run browsers. ║
16:29:17 ║ Missing libraries: ║
16:29:17 ║ libjpeg.so.8 ║
16:29:17 ╚══════════════════════════════════════════════════════╝

该版本Playwright与当前Debian系统存在兼容性问题,需临时解决依赖缺失问题。

已执行操作

其他缺失的依赖库已通过以下命令安装完成:

sudo apt-get install -y libicu66 libicu66 libxslt1.1 libopengl0 libwoff1 libharfbuzz-icu0 libgstreamer-gl1.0-0 libjpeg8 libwebpdemux2 libenchant-2-2 libsecret-1-0 libhyphen0 libffi7 libevdev2 libgudev-1.0-0 libgles2

尝试安装Ubuntu的libjpeg-turbo8包时,执行相关命令后报错:

wget 对应libjpeg-turbo8 deb包地址
sudo apt install ./libjpeg-turbo8_2.1.2-0ubuntu1_amd64.deb

报错信息

18:25:24 Saving to: ‘libjpeg-turbo8_2.1.2-0ubuntu1_amd64.deb.3’
18:25:24
18:25:25 0K .......... .......... .......... .......... .......... 38% 378K 0s
18:25:25 50K .......... .......... .......... .......... .......... 76% 751K 0s
18:25:25 100K .......... .......... .......... . 100% 127M=0.2s
18:25:25
18:25:25 2022-11-26 04:55:25 (659 KB/s) - ‘libjpeg-turbo8_2.1.2-0ubuntu1_amd64.deb.3’ saved [134436/134436]
18:25:25
18:25:25 [Pipeline] sh
18:25:25 + sudo apt install ./libjpeg-turbo8_2.1.2-0ubuntu1_amd64.deb
18:25:25
18:25:25 WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
18:25:25
18:25:26 Reading package lists...
18:25:26 E: Sub-process Popen returned an error code (2)
18:25:26 E: Encountered a section with no Package: header
18:25:26 E: Problem with MergeList /home/hudson/inmem_workspace/blink-playwright/libjpeg-turbo8_2.1.2-0ubuntu1_amd64.deb
18:25:26 E: The package lists or status file could not be parsed or opened.

解决方法

1. 改用dpkg安装本地deb包

apt安装本地包时容易因工作目录的MergeList解析失败,换用dpkg直接操作:

# 获取对应架构的libjpeg-turbo8 deb包后执行
sudo dpkg -i libjpeg-turbo8_2.1.2-0ubuntu1_amd64.deb
# 若出现依赖缺失,运行修复命令
sudo apt-get install -f

2. 安装Debian快照仓库的libjpeg8包

从Debian快照仓库获取版本为8d1-2的libjpeg8对应架构deb包,执行以下命令:

sudo dpkg -i libjpeg8_8d1-2_amd64.deb
# 修复可能的依赖问题
sudo apt-get install -f

3. 创建软链接临时兼容(仅临时应急)

如果系统中存在更高版本的libjpeg库(如libjpeg.so.62),可通过软链接模拟libjpeg.so.8:

# 先确认高版本库是否存在
ls /usr/lib/x86_64-linux-gnu/libjpeg.so.*
# 创建软链接
sudo ln -s /usr/lib/x86_64-linux-gnu/libjpeg.so.62 /usr/lib/x86_64-linux-gnu/libjpeg.so.8

注:该方法可能引发兼容性问题,仅建议临时使用。

4. 升级Playwright版本(长期解决方案)

Playwright 1.28版本较旧,后续版本已适配新系统依赖,建议升级至最新稳定版:

npm install @playwright/test@latest
# 重新安装浏览器及对应依赖
npx playwright install --with-deps

内容的提问来源于stack exchange,提问作者mark_Ruff

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.10 22:45:38