-
Notifications
You must be signed in to change notification settings - Fork 0
Troubleshooting
This guide helps you resolve common issues with the Portfolio-ManideepSP project.
# Build with verbose output
npm run build -- --verbose
# Check for errors
npm run validate- Open Developer Tools (F12)
- Go to Console tab
- Look for errors (red text)
- Check Network tab for failed requests
- Go to repository β Actions tab
- Click on latest workflow run
- Review logs for errors
Symptoms:
Error: The engine "node" is incompatible with this module
Solution:
# Check your Node version
node -v
# Should be v18 or higher
# Install/use Node 18+
nvm install 18
nvm use 18
# Or download from nodejs.orgSymptoms:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
Solution 1: Clear cache and reinstall
rm -rf node_modules package-lock.json
npm cache clean --force
npm installSolution 2: Use legacy peer deps
npm install --legacy-peer-depsSymptoms:
EACCES: permission denied
Solution:
# Don't use sudo! Fix npm permissions instead
mkdir ~/.npm-global
npm config set prefix '~/.npm-global'
echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.bashrc
source ~/.bashrcSymptoms:
npm run build
> Error: Build failed
Solution:
# 1. Check for syntax errors
npm run validate
# 2. Clear Astro cache
rm -rf .astro dist
# 3. Rebuild
npm run build
# 4. Check specific error in output
npm run build 2>&1 | grep -i errorSymptoms:
FATAL ERROR: Reached heap limit Allocation failed
Solution:
# Increase Node memory
NODE_OPTIONS="--max-old-space-size=4096" npm run buildSymptoms:
Error: Cannot find module 'some-package'
Solution:
# Reinstall dependencies
npm install
# Or install specific package
npm install some-packageSymptoms:
npm run validate
> Configuration validation failed
Solution:
-
Check
src/lib/config.jsonsyntax:# Validate JSON syntax node -e "JSON.parse(require('fs').readFileSync('src/lib/config.json'))"
-
Common issues:
- Missing comma
- Extra comma at end
- Unquoted strings
- Missing quotes around keys
Example Fix:
// β Bad
{
"name": "John Doe"
"email": "john@example.com",
}
// β
Good
{
"name": "John Doe",
"email": "john@example.com"
}Symptoms:
- 404 error in browser console
- Resume viewer shows blank page
Solution:
-
Check file exists:
ls -la public/resumes/
-
Check path in
config.json:{ "resume": { "displayLink": "/resumes/YourResume.pdf", // Must start with / "downloadFilename": "YourResume.pdf" } } -
File name must match exactly (case-sensitive):
# β Wrong "displayLink": "/resumes/resume.pdf" # File: public/resumes/Resume.PDF # β Correct "displayLink": "/resumes/Resume.PDF" # File: public/resumes/Resume.PDF
Symptoms:
- Homepage works but other pages return 404
- CSS/JS not loading
- Images broken
Solution:
Check astro.config.mjs:
export default defineConfig({
site: 'https://YOUR-USERNAME.github.io',
base: '/YOUR-REPO-NAME', // Must match repository name exactly
});Example:
// For repository: github.com/johnsmith/my-portfolio
site: 'https://johnsmith.github.io',
base: '/my-portfolio', // Not '/My-Portfolio' or '/portfolio'Symptoms:
- Red X on commit
- Deployment doesn't complete
Solution:
-
Check Actions tab for error details
-
Common issues:
Build fails:
# Test build locally first npm run buildPermission denied:
- Settings β Actions β General
- Workflow permissions β Read and write permissions
- Save
Missing secret:
- Settings β Secrets β Actions
- Add required secrets (e.g., GITHUB_TOKEN)
Symptoms:
- Site deployed but shows 404
- Only homepage works
Solution:
-
Check GitHub Pages settings:
- Settings β Pages
- Source:
gh-pagesbranch - Folder:
/ (root)
-
Wait 1-2 minutes for GitHub to update
-
Check
baseinastro.config.mjsmatches repo name -
Clear browser cache:
Ctrl+Shift+R (Windows/Linux) Cmd+Shift+R (Mac)
Symptoms:
- Styles not applied
- Images broken
- JavaScript errors
Solution:
-
Check browser console for 404 errors
-
Ensure assets use correct base path:
// β Wrong <img src="/images/photo.jpg" /> // β Correct (with base) <img src={`${import.meta.env.BASE_URL}images/photo.jpg`} /> // β Also correct (Astro handles this) <img src="/images/photo.jpg" /> // If base is configured properly
-
Rebuild and redeploy:
npm run build git add dist git commit -m "Rebuild with correct paths" git push
Symptoms:
- Form submission fails
- No issue created on GitHub
Solution:
-
Check Cloudflare Worker is deployed:
npx wrangler list
-
Check Worker URL in
config.json:{ "contactWorkerUrl": "https://your-worker.workers.dev/" } -
Test Worker directly:
curl -X POST https://your-worker.workers.dev/ \ -H "Content-Type: application/json" \ -d '{"name":"Test","email":"test@example.com","message":"Test"}'
-
Check browser console for CORS errors
Symptoms:
Access to fetch at '...' from origin '...' has been blocked by CORS policy
Solution:
Update CORS_ORIGIN in cloudflare-worker/worker.js:
// Must match your site URL exactly
const CORS_ORIGIN = 'https://yoursite.github.io';
// Or for development
const CORS_ORIGIN = '*';Redeploy worker:
npm run deploy:workerSymptoms:
- Worker returns 401 error
- "Bad credentials" error
Solution:
-
Generate new GitHub token:
- GitHub β Settings β Developer settings
- Personal access tokens β Tokens (classic)
- Generate new token with
reposcope
-
Update Worker secret:
npx wrangler secret put GITHUB_TOKEN # Paste new token when prompted -
Redeploy:
npm run deploy:worker
Symptoms:
- Page looks unstyled
- Fonts not loading
- Colors wrong
Solution:
-
Check CSS files exist:
ls src/styles/
-
Check imports in components:
--- import '../styles/global.css'; import '../styles/vars.css'; ---
-
Clear cache and rebuild:
rm -rf .astro dist npm run build
Symptoms:
- Default system font showing
- Console error about font
Solution:
-
Check Google Fonts import in
src/styles/global.css:@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700;800&display=swap');
-
Check font-family in CSS:
body { font-family: 'Inter', sans-serif; }
-
Test font URL in browser
Symptoms:
- Broken image icon
- 404 in console
Solution:
-
Check file exists:
ls public/images/
-
Check path in code:
<!-- Files in public/ are served from root --> <img src="/images/photo.jpg" alt="Photo" />
-
Check file extension matches:
# Case-sensitive on Linux/Mac # photo.jpg β photo.JPG
Symptoms:
- Images load slowly
- Large file sizes
Solution:
-
Optimize images before adding:
# Install imagemagick brew install imagemagick # Mac sudo apt install imagemagick # Linux # Optimize convert input.jpg -quality 85 -resize 1920x output.jpg
-
Use modern formats (WebP):
cwebp input.jpg -q 85 -o output.webp
Symptoms:
- Text too small
- Elements overlap
- Horizontal scroll
Solution:
-
Check viewport meta tag in
BaseLayout.astro:<meta name="viewport" content="width=device-width, initial-scale=1.0" />
-
Test responsive design:
# Use browser DevTools # F12 β Toggle device toolbar (Ctrl+Shift+M)
-
Check media queries in CSS:
/* Mobile first */ .element { width: 100%; } /* Desktop */ @media (min-width: 768px) { .element { width: 50%; } }
Symptoms:
Warning: Text content did not match. Server: "..." Client: "..."
Solution:
-
Ensure same data on server and client
-
Don't use
Date.now()or random values in render:// β Bad <div>{Date.now()}</div> // β Good const timestamp = Date.now(); <div>{timestamp}</div>
-
Use
client:onlyfor client-only components:<Component client:only="react" />
Symptoms:
- ScrollReveal animations don't trigger
- Elements don't fade in
Solution:
-
Check ScrollReveal is imported:
import ScrollReveal from 'scrollreveal';
-
Initialize after DOM loads:
useEffect(() => { ScrollReveal().reveal('.animate', { duration: 1000, distance: '50px', origin: 'bottom' }); }, []);
-
Check elements have class:
<div class="animate">Content</div>
Symptoms:
Error: listen EADDRINUSE: address already in use :::4321
Solution:
# Option 1: Kill process on port 4321
lsof -ti:4321 | xargs kill -9
# Option 2: Use different port
npm run dev -- --port 3000Symptoms:
- Changes don't appear
- Need to refresh manually
Solution:
-
Restart dev server:
# Ctrl+C to stop npm run dev -
Clear cache:
rm -rf .astro
-
Check file watcher limits (Linux):
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf sudo sysctl -p
Symptoms:
- Build takes several minutes
- High CPU/memory usage
Solution:
-
Clear cache before building:
rm -rf .astro dist node_modules/.cache
-
Optimize images before adding
-
Reduce number of projects fetched
-
Use build caching in CI:
# In .github/workflows/deploy.yml - uses: actions/cache@v3 with: path: ~/.npm key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
Symptoms:
- Slow page load
- Large JavaScript files
Solution:
-
Check bundle size:
npm run build du -sh dist/
-
Use dynamic imports:
// Instead of import HeavyComponent from './Heavy'; // Use const HeavyComponent = lazy(() => import('./Heavy'));
-
Remove unused dependencies:
npm uninstall unused-package
Symptoms:
- GitHub security alerts
- Vulnerable dependencies
Solution:
# Check for vulnerabilities
npm audit
# Fix automatically
npm audit fix
# Force fix (may break things)
npm audit fix --force
# Update specific package
npm update vulnerable-packageSymptoms:
- GitHub token committed to repo
- GitHub revoked token
Solution:
-
Immediately revoke token on GitHub
-
Generate new token
-
Remove from git history:
# Use BFG Repo-Cleaner or git-filter-branch # See GitHub docs for details
-
Add to
.gitignore:.env .env.local *.env
Before asking for help, collect:
# System info
node -v
npm -v
git --version
# Error logs
npm run build 2>&1 | tee build.log
# Package info
npm list --depth=0- Check existing issues: GitHub Issues
- Search documentation: Wiki Home
- Create new issue: Include debug info above
- Astro Discord: Join here
Include:
- What you were trying to do
- What you expected to happen
- What actually happened
- Error messages (full text)
- System information
- Steps to reproduce
Template:
## Description
Brief description of the issue
## Steps to Reproduce
1. Step 1
2. Step 2
3. Step 3
## Expected Behavior
What should happen
## Actual Behavior
What actually happens
## Error MessagesPaste error messages here
## Environment
- Node version:
- npm version:
- OS:
- Browser:
Related: See also Getting Started β’ Configuration β’ Deployment