Jenkins 构建 VUE 前端提示 pnpm 错误

错误日志为:

复制代码
+ 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 工具就会找到对应的命令让构建继续。

https://www.isharkfly.com/t/jenkins-vue-pnpm/9314

相关推荐
2分钟速写快排6 小时前
孔乙己的茴字有多少种写法?|AI 对话实时通信的三种实现
前端·javascript·github
Penge6668 小时前
JavaScript:BOM 详解
前端
梯度下降者8 小时前
Nuxt框架
vue.js·服务端渲染·全栈开发·混合渲染·nuxt框架
Penge6669 小时前
Vite vs Webpack:前端构建工具原理与实战
前端
Penge6669 小时前
前端包管理工具:npm、Yarn、pnpm 快速入门
前端
Penge6669 小时前
Sass 了解
前端
Penge6669 小时前
Webpack 打包从 0 到 1 实战笔记
前端
Penge6669 小时前
Webpack 入门:是什么、为什么需要、怎么使用?
前端
Penge66610 小时前
Ant Design(Antd)了解
前端
wangruofeng10 小时前
同一行代码,百种渲染:Asuka、React Native 与 Flutter 跨平台渲染机制深度拆解
前端·github