Fix frontend build dependencies

This commit is contained in:
2026-03-28 22:39:14 +08:00
parent 728cf36e7c
commit e69c637dba
3 changed files with 8 additions and 3 deletions

View File

@@ -174,7 +174,11 @@ build_frontend() {
echo ""
echo -e "${CYAN}构建前端...${NC}"
if [ -d "frontend" ] && command -v npm >/dev/null 2>&1; then
(cd frontend && npm install --legacy-peer-deps && npm run build)
if [ -f "frontend/package-lock.json" ]; then
(cd frontend && npm ci && npm run build)
else
(cd frontend && npm install && npm run build)
fi
echo -e "${GREEN}前端构建完成: ${FRONTEND_DIST}${NC}"
else
echo -e "${RED}前端构建失败: 需要 npm 和 frontend 目录${NC}"