Common Issues
Common Issues
Section titled “Common Issues”This page provides solutions to common problems you might encounter while working with nodecode-docs-astro.
Build Errors
Section titled “Build Errors”Frontmatter Validation Failed
Section titled “Frontmatter Validation Failed”Symptom:
[ERROR] Frontmatter does not match schemaCause: Invalid or missing required frontmatter fields
Solution:
-
Check that all required fields are present:
---title: Your Page Title # Requireddescription: Your page description # Required--- -
Verify field types are correct:
titlemust be a stringdescriptionmust be a stringtemplatemust be “doc” or “splash” (if provided)
-
Check for syntax errors in YAML:
- Ensure proper indentation
- Quote strings with special characters
- No tabs (use spaces only)
Content Collection Not Found
Section titled “Content Collection Not Found”Symptom:
[ERROR] Collection "docs" does not existCause: Missing or incorrect src/content/config.ts file
Solution:
-
Ensure
src/content/config.tsexists and exports collections:import { defineCollection } from 'astro:content';import { docsSchema } from '@astrojs/starlight/schema';export const collections = {docs: defineCollection({ schema: docsSchema() }),}; -
Restart the development server after creating the config file
TypeScript Errors
Section titled “TypeScript Errors”Symptom:
Property 'title' does not exist on type...Cause: TypeScript types not generated yet
Solution:
-
Run the type generation command:
Terminal window bun run check -
Restart your IDE/editor to pick up new types
-
Ensure
tsconfig.jsonincludes content directory
Development Server Issues
Section titled “Development Server Issues”Port Already in Use
Section titled “Port Already in Use”Symptom:
[ERROR] Port 4321 is already in useSolution:
-
Kill the process using the port:
Terminal window # Find the processlsof -i :4321# Kill itkill -9 <PID> -
Or use a different port:
Terminal window bun run dev -- --port 3000
Hot Reload Not Working
Section titled “Hot Reload Not Working”Symptom: Changes to files don’t trigger automatic reload
Solution:
- Check file is in watched directory (
src/orpublic/) - Restart the development server
- Clear browser cache (Ctrl+Shift+R or Cmd+Shift+R)
- Check for file system permissions issues
CSS Changes Not Applying
Section titled “CSS Changes Not Applying”Symptom: CSS changes don’t appear in the browser
Solution:
-
Verify custom CSS is imported in
astro.config.mjs:starlight({customCss: ['./src/styles/tokens.css','./src/styles/theme.css',],}) -
Clear browser cache with hard reload
-
Check browser developer tools for CSS errors
-
Ensure CSS files are in
src/styles/directory
Content Issues
Section titled “Content Issues”Page Not Appearing in Sidebar
Section titled “Page Not Appearing in Sidebar”Symptom: New page doesn’t show up in navigation
Solution:
- Verify file is in correct location:
src/content/docs/ - Check frontmatter includes
titlefield - Ensure sidebar configuration in
astro.config.mjs:sidebar: [{label: 'Section Name',autogenerate: { directory: 'section-name' }}] - Try setting explicit
sidebar.orderin frontmatter
Broken Internal Links
Section titled “Broken Internal Links”Symptom: Clicking internal link shows 404 error
Solution:
- Use relative paths:
/guides/getting-startednotguides/getting-started - Don’t include
.mdextension in links - Verify target file exists in
src/content/docs/ - Check for typos in file paths
Images Not Loading
Section titled “Images Not Loading”Symptom: Images show broken image icon
Solution:
- Place images in
public/directory for static assets - Or use
src/assets/with import statements - Use correct path:
- Public:
/images/photo.jpg - Assets:
import photo from '../assets/photo.jpg'
- Public:
- Verify file extension matches actual file
Deployment Issues
Section titled “Deployment Issues”Build Fails in Production
Section titled “Build Fails in Production”Symptom: Build succeeds locally but fails in CI/CD
Solution:
- Check Node.js version matches local environment
- Verify all dependencies in
package.json - Check for environment-specific code
- Review build logs for specific errors
- Test production build locally:
Terminal window bun run buildbun run preview
Environment Variables Not Working
Section titled “Environment Variables Not Working”Symptom: Environment variables undefined in build
Solution:
-
Prefix with
PUBLIC_for client-side access:PUBLIC_API_URL=https://api.example.com -
Access in code:
import.meta.env.PUBLIC_API_URL -
Set variables in deployment platform (Cloudflare Pages, Netlify, etc.)
Performance Issues
Section titled “Performance Issues”Slow Build Times
Section titled “Slow Build Times”Symptom: Build takes longer than expected
Solution:
- Reduce number of pages (split into multiple sites if very large)
- Optimize images before adding to project
- Use Bun instead of npm/yarn for faster builds
- Clear
.astrocache directory and rebuild - Check for expensive computations in components
Large Bundle Size
Section titled “Large Bundle Size”Symptom: JavaScript bundle is larger than expected
Solution:
- Check for unnecessary imports
- Use dynamic imports for heavy components:
const Component = (await import('./Component.astro')).default;
- Review Astro DevTools for bundle analysis
- Consider code splitting strategies
Getting More Help
Section titled “Getting More Help”If you’re still experiencing issues:
- Check the Astro documentation
- Visit the Starlight documentation
- Search existing GitHub issues
- Ask in the Astro Discord community
- Review this project’s README for specific setup instructions
Reporting Bugs
Section titled “Reporting Bugs”When reporting a bug, please include:
- Node.js and Bun versions
- Operating system
- Steps to reproduce
- Error messages (full stack trace if available)
- Expected vs actual behavior
- Relevant code snippets or configuration files