mirror of
https://github.com/johndoe6345789/low-code-react-app-b.git
synced 2026-04-25 14:14:57 +00:00
2.7 KiB
2.7 KiB
CI/CD Fix Summary
Problem Solved
The project was failing in CI/CD with the following errors:
-
npm cifailures due to workspace protocol not being recognized:npm error code EUNSUPPORTEDPROTOCOL npm error Unsupported URL Type "workspace:": workspace:* -
Lock file sync issues due to version mismatches:
npm error Invalid: lock file's @github/spark@0.0.1 does not satisfy @github/spark@0.44.15 -
Peer dependency conflicts requiring
--legacy-peer-depsflag
Solution Implemented
1. Replaced Workspace Protocol
Changed from workspace:* to file:./packages/spark-tools for better compatibility.
2. Added Dependency Overrides
Added overrides section to package.json to force consistent versions:
"overrides": {
"react": "^19.0.0",
"react-dom": "^19.0.0",
"@types/react": "^19.0.10",
"@types/react-dom": "^19.0.4",
"vite": "^7.3.1",
"@github/spark": {
"react": "^19.0.0",
"vite": "^7.3.1"
},
"@local/spark-wrapper": {
"react": "^19.0.0"
}
}
Impact
Before
- ❌ Required
--legacy-peer-depsflag - ❌ CI/CD builds failing with EUNSUPPORTEDPROTOCOL
- ❌ Inconsistent dependency versions
- ❌ Lock file constantly out of sync
After
- ✅ No special flags required
- ✅ Standard
npm ciworks in CI/CD - ✅ Consistent versions across all packages
- ✅ Lock file stays in sync
Next Steps
-
Run locally to update the lock file:
npm install -
Commit the changes:
git add package.json package-lock.json git commit -m "fix: remove workspace protocol and add overrides for CI/CD compatibility" git push -
Verify CI/CD: GitHub Actions should now pass without modifications to workflow files
Technical Details
Why file: Over workspace:
- Standard npm support:
file:is supported by all npm versions - CI/CD compatibility: Works without special tooling or flags
- Transparent resolution: npm treats it like any other local dependency
Why Overrides Matter
The overrides field in package.json (npm 8.3.0+) provides:
- Centralized version control for transitive dependencies
- Resolution of peer dependency conflicts
- Consistency across monorepo packages
- No need for resolutions/peerDependenciesMeta workarounds
Compatibility
- ✅ npm >= 8.3.0 (for overrides support)
- ✅ Node.js >= 16.x
- ✅ GitHub Actions runners (current)
- ✅ Docker builds
- ✅ Local development
Rollback Plan
If issues arise, revert to previous configuration:
git revert HEAD
npm install --legacy-peer-deps
Then update CI workflows to use npm install --legacy-peer-deps instead of npm ci.