3.3 KiB
Troubleshooting Guide
Common Errors and Solutions
Vite Module Resolution Error
Error Message:
Cannot find module '/workspaces/spark-template/node_modules/vite/dist/node/chunks/dist.js'
imported from /workspaces/spark-template/node_modules/vite/dist/node/chunks/config.js
Cause: This error occurs when npm's workspace dependencies are not properly resolved or the node_modules cache is corrupted.
Solutions:
-
Quick Fix (Recommended):
rm -rf node_modules package-lock.json npm install -
Alternative Fix:
npm clean-install -
If using npm workspaces:
npm install --force -
For persistent issues:
# Clear npm cache npm cache clean --force # Remove all modules rm -rf node_modules package-lock.json rm -rf packages/*/node_modules # Reinstall npm install
TypeScript Duplicate Export Errors
Error: Ambiguous re-exports of StatCard, EmptyState, or LoadingState
Solution: Already fixed in src/components/index.ts - exports are now explicitly separated to avoid naming conflicts.
Build/CI Errors
npm ci fails with workspace protocol
Error: Unsupported URL Type "workspace:": workspace:*
Solution: The package.json uses file:./packages/spark-tools instead of workspace:* protocol. This is already configured correctly.
E2E Test Errors
Playwright not found
Error: sh: 1: playwright: not found
Solution: Run npx playwright install or update the test script to use npx:
"test:e2e": "npx playwright test"
Timeout waiting for webServer
Error: Timed out waiting 180000ms from config.webServer
Solution: Check that:
- Port 5000 is available
- Vite dev server starts successfully
- Increase timeout in
playwright.config.tsif needed
Docker Build Errors
workspace protocol not supported
Fix Applied: Dockerfile uses npm install instead of npm ci
Preview Mode Issues (Codespaces)
502 Bad Gateway errors
Cause: Dev server not bound to external interface or wrong port
Solution:
- Ensure
vite.config.tshas:server: { host: '0.0.0.0', port: 5000, } - Forward port 5000 in Codespaces
- Use the forwarded URL, not localhost
SASS/CSS Warnings
Warnings about unknown at-rules (@include respond-to) are expected - they're processed by Sass before Tailwind sees them.
Linting Issues
Run npm run lint to automatically fix most linting issues.
For manual fixes:
- Empty blocks: Add a comment or remove the block
- Unused variables: Prefix with underscore
_variableNameor remove
Development Tips
Fast Refresh Not Working
- Ensure all components are exported as named exports
- Check that files are within the
srcdirectory - Restart the dev server
Slow Build Times
The app uses code splitting and lazy loading. First build may be slow, but subsequent builds are faster.
Memory Issues
If you encounter memory errors during build:
NODE_OPTIONS="--max-old-space-size=4096" npm run build
Getting Help
- Check this document first
- Review error logs carefully
- Try the quick fixes above
- Check GitHub Actions logs for CI issues
- Ensure all dependencies are up to date