Skip to content

Commit 0722be8

Browse files
committed
fix: 解决依赖冲突并优化CI配置
## 问题修复 1. **依赖版本冲突**: 将vite从^7.2.4降级到^5.4.21,与@vitejs/plugin-react@5.1.1兼容 2. **CI优化**: 添加--legacy-peer-deps选项处理可能的依赖冲突 3. **错误处理**: 改进CI工作流的错误处理和回退机制 ## 兼容性说明 - vite@5.4.21 与 @vitejs/plugin-react@5.1.1 完全兼容 - 使用--legacy-peer-deps避免peer依赖冲突 - 保持React 19.2.0的最新版本 - 确保TypeScript和其他依赖正常工作
1 parent 9b40374 commit 0722be8

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

.github/workflows/frontend-test.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,17 @@ jobs:
2525
cd frontend
2626
# 先检查是否有package-lock.json或yarn.lock
2727
if [ -f "package-lock.json" ]; then
28-
npm ci
28+
echo "📦 Using npm ci with legacy peer deps..."
29+
npm ci --legacy-peer-deps || {
30+
echo "⚠️ npm ci failed, trying npm install..."
31+
npm install --legacy-peer-deps
32+
}
2933
elif [ -f "yarn.lock" ]; then
34+
echo "🧶 Using yarn install..."
3035
yarn install --frozen-lockfile
3136
else
32-
npm install
37+
echo "📦 Using npm install with legacy peer deps..."
38+
npm install --legacy-peer-deps
3339
fi
3440
3541
- name: Build frontend

frontend/package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frontend/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@
1818
"@vitejs/plugin-react": "^5.1.1",
1919
"terser": "^5.46.0",
2020
"typescript": "~5.9.3",
21-
"vite": "^7.2.4"
21+
"vite": "^5.4.21"
2222
}
2323
}

0 commit comments

Comments
 (0)