错误日志为:
+ npx browserslist@latest --update-db
npm warn exec The following package was not found and will be installed: browserslist@4.28.2
The --update-db command is deprecated.
Please use npx update-browserslist-db@latest instead.
Browserslist DB update will still be made.
/bin/sh: 1: pnpm: not found
node:child_process:957
throw err;
^
Error: Command failed: pnpm info caniuse-lite --json
/bin/sh: 1: pnpm: not found
at genericNodeError (node:internal/errors:983:15)
at wrappedFn (node:internal/errors:537:14)
at checkExecSyncError (node:child_process:882:11)
at execSync (node:child_process:954:15)
at getLatestInfo (/var/lib/jenkins/.npm/_npx/072487b38308305a/node_modules/update-browserslist-db/index.js:80:23)
at updateDB (/var/lib/jenkins/.npm/_npx/072487b38308305a/node_modules/update-browserslist-db/index.js:282:16)
at Object.<anonymous> (/var/lib/jenkins/.npm/_npx/072487b38308305a/node_modules/browserslist/cli.js:47:3)
at Module._compile (node:internal/modules/cjs/loader:1554:14)
at Object..js (node:internal/modules/cjs/loader:1706:10)
at Module.load (node:internal/modules/cjs/loader:1289:32) {
status: 127,
signal: null,
output: [
null,
Buffer(0) [Uint8Array] [],
Buffer(28) [Uint8Array] [
47, 98, 105, 110, 47, 115, 104,
58, 32, 49, 58, 32, 112, 110,
112, 109, 58, 32, 110, 111, 116,
32, 102, 111, 117, 110, 100, 10
]
],
pid: 2279551,

原因和解决
上面问题的原因是 Jenkins 虽然配置了 Node 构建环境,但是没有安装 pnpm 构建工具。
找到 Jenkins 中的工具。

在 NodeJS 的安装配置中,添加 pnpm。

重新触发构建后,pnpm 工具就会找到对应的命令让构建继续。