前端代码构建失败

root@c33e:/node20/Architecture. low_code_front_master# pnpm run buiId:prod

> jeelowcode-ui-admin-vue3@1. 0. 0 buiId:prod /node20/Architecture. low_code_front_master

> node --max_old_space_size=8192 . /node_modules/vite/bin/vite. js bui ld --mode prod

The CJS build of Vite's Node APl is deprecated. See https://vitejs. dev/guide/troubleshooting.html#vite-cj

S-node-api-deprecated for more detai ls.

failed to load config from /node20/Architecture. low_code_front_master/vite. config.ts

error during buiId:

Error [ERR_REQUIRE_ESM] : require O of ES Module /node20/Architecture.low_code_front_master/node_mod

ules/. pnpm/package-manager-detector@1. 3. 0/node_modules/package-manager-detector/dist/detect. mjs not suppo

rted.

Instead change the require of /node20/Architecture. low_code_front_master/node_modules/. pnpm/package

manager-detector@1. 3. 0/node_modules/package-manager-detector/dist/detect.mjs to a dynamic import O which

is available in all CommonJS modules.

    at Object. <anonymous> (/node20/Architecture. low_code_front_master/node_modules/. pnpm/@antfu+ins

tal I-pkg@1. 1. 0/node_modules/@antfu/instal I-pkg/dist/index. cjs:41:21)

    at _require.extensions.<computed> [as . js] (file:///node20/Architecture. guard_low_code_front_master/n

ode_modules/. pnpm/vite@5. 2. 12_@types+node@20. 19. 1_sass@1. 89.2_terser@5. 43. 0/node_modules/vite/dist/node/c

hunks/dep-BKbDVx1T. js : 69932: 17)

[ELIFECYCLE[ Command failed with exit code 1.


评论区

超级管理员 2025-06-19 14:13

可能是@antfu/install-pkg版本问题

image.png

lanlystrong 2025-06-19 14:21

@超级管理员

screenshot_2025-06-19_14-21-20.png

lanlystrong 2025-06-19 14:22

@超级管理员

同时这个项目构建非常耗时,一次构建,我们ci/cd 都会被阻塞,其他项目都构建不了了,有没有优化的方法

超级管理员 2025-06-19 14:40

@lanlystrong

后续更新会补上打包优化

超级管理员 2025-06-19 14:41

@lanlystrong

打包的问题,看是ESM 模块的问题 但是是哪个依赖的不确定,我这边打包是正常的

lanlystrong 2025-06-20 08:53

@超级管理员
本地打包 正常, 但是用docker构建就失败

超级管理员 2025-06-20 09:09

@lanlystrong

那就要自己看一下什么原因了,可能是构建的环境问题吧


回复