Troubleshooting
This guide covers common issues you may encounter when building, customizing, or deploying a varsha site, along with solutions and workarounds.
Build errors
Section titled “Build errors”npm run build fails with Node version error
Section titled “npm run build fails with Node version error”Symptom: The build fails with an error about unsupported Node.js syntax or an “engine” requirement.
Solution: Ensure you are using Node.js 18.17.0+, 20.3.0+, or later. Check your version:
node --versionIf you have an older version, upgrade via nodejs.org or a version manager like nvm or fnm.
Error: Cannot find module '@astrojs/vercel' (or other integration)
Section titled “Error: Cannot find module '@astrojs/vercel' (or other integration)”Symptom: Build fails with a module resolution error for an Astro integration.
Solution: varsha uses static output and does not require any adapter. If you added an adapter for SSR and are missing the dependency, install it:
npm installIf you no longer need SSR, remove the adapter from astro.config.mjs and revert to output: 'static'. See the Integrations guide.
Content collection schema validation errors
Section titled “Content collection schema validation errors”Symptom: Build fails with a Zod validation error about blog post or doc frontmatter.
Solution: Check the frontmatter of your content files against the schema defined in src/content.config.ts. Common issues:
- Missing required fields (
title,description,pubDatefor blog posts) - Incorrect date format (use ISO
"2025-01-20"format) - Typo in field names
Sitemap generation fails
Section titled “Sitemap generation fails”Symptom: Build error related to @astrojs/sitemap.
Solution: Ensure site is set in astro.config.mjs. The sitemap integration requires an absolute URL:
export default defineConfig({ site: 'https://your-domain.com', // ...});Port 4321 already in use
Section titled “Port 4321 already in use”Symptom: npm run dev fails because the port is occupied.
Solution: Specify a different port:
npm run dev -- --port 3000Development server issues
Section titled “Development server issues”Changes not reflecting in the browser
Section titled “Changes not reflecting in the browser”Symptom: You edit a file but the browser does not update.
Solution:
- Hard-refresh the browser (Ctrl+Shift+R or Cmd+Shift+R)
- Check that the file is saved
- Restart the dev server: press
Ctrl+Cand runnpm run devagain - Clear browser cache if the issue persists
Styles not applying on custom pages
Section titled “Styles not applying on custom pages”Symptom: Your new marketing page renders without the expected styling.
Solution:
- Ensure your page uses
MarketingLayout— it loads the global CSS - Wrap page content in
<main class="page">for proper padding - Use the documented CSS classes:
.hero,.section,.container,.feature-grid, etc. - Check that you are using CSS tokens (
var(--bg),var(--fg)) rather than hardcoded colors
Theme switcher not working
Section titled “Theme switcher not working”Symptom: Pressing / or t does not open the theme switcher.
Solution:
- Make sure you are on a marketing page that uses
MarketingLayout(the theme switcher is included in that layout) - Check that your cursor is not in an input field, textarea, or code editor
- The theme switcher script is in
MarketingLayout.astro— verify it has not been removed
Attribution credit not visible
Section titled “Attribution credit not visible”Symptom: The “Built with varsha” credit does not appear.
Solution: The BuiltWith credit should appear automatically on pages using MarketingLayout. If it is missing:
- Do not attempt to hide or remove it — it is required
- Check that
MarketingLayout.astrostill includes the<BuiltWith>component and the self-healing script - Verify the
builtwith-creditCSS class is not being overridden todisplay: none
The self-healing script re-injects the credit every 2.5 seconds if it is removed. If you see it repeatedly reappearing, it means something on your page is actively removing it.
Deployment issues
Section titled “Deployment issues”Vercel deployment fails
Section titled “Vercel deployment fails”Symptom: Vercel build fails or the deployed site shows an error.
Solution:
- Ensure the build command is
npm run buildand output directory isdist - Verify Node.js version in Vercel project settings (use 18.x or 20.x)
- Check build logs for specific errors
- Ensure all environment variables are configured in Vercel dashboard
Netlify deployment shows 404 on subpages
Section titled “Netlify deployment shows 404 on subpages”Symptom: Direct navigation to /about/ or /blog/post/ returns a404 on Netlify.
Solution: Create a public/_redirects file:
/* /index.html 200Or use a netlify.toml as shown in the Deployment guide.
Cloudflare Pages CSS or assets not loading
Section titled “Cloudflare Pages CSS or assets not loading”Symptom: Site loads but appears unstyled, or images are broken.
Solution:
- Verify the build output directory is set to
dist - Check that the build command completed successfully (look for “Build complete” in logs)
- Ensure you are not using Node.js features that require a newer version than Cloudflare’s default
GitHub Pages shows 404
Section titled “GitHub Pages shows 404”Symptom: Pages site returns 404 after deployment.
Solution:
- Ensure
baseinastro.config.mjsmatches your repository name (e.g.,base: '/varsha') - Wait a few minutes for GitHub Pages to propagate after the first deploy
- Check that the Pages source is set to “GitHub Actions” in repository settings
OG images not appearing in social shares
Section titled “OG images not appearing in social shares”Symptom: Links shared on Twitter, Slack, or other platforms show no preview image.
Solution:
- Verify the OG image URL in
astro.config.mjsandMarketingLayout.astrouses an absolute URL - Ensure
siteis set to your production domain - Test with Twitter Card Validator or Facebook Sharing Debugger
- OG images must be 1200x630 pixels and publicly accessible
Sitemap returns 404
Section titled “Sitemap returns 404”Symptom: Visiting /sitemap-index.xml returns a 404 error.
Solution:
- Ensure
@astrojs/sitemapis in your dependencies andastro.config.mjs - Set
siteinastro.config.mjsto your production domain - Run
npm run buildand check thatdist/sitemap-index.xmlexists - The sitemap is only generated during
npm run build, not innpm run dev
Localization issues
Section titled “Localization issues”Japanese or Chinese docs not showing
Section titled “Japanese or Chinese docs not showing”Symptom: Locale routes (/ja/docs/, /zh-cn/docs/) return 404.
Solution:
- Verify the locale is configured in
astro.config.mjsunderlocales - Check that the locale directory exists (
src/content/docs/ja/orsrc/content/docs/zh-cn/) - Each locale directory needs an
index.mdxfile - Restart the dev server after adding new locale directories
Content issues
Section titled “Content issues”Blog post not appearing in listing
Section titled “Blog post not appearing in listing”Symptom: A new blog post does not show up on the /blog/ page.
Solution:
- Ensure the file is in
src/content/blog/with a.mdextension - Check that
draft: trueis not set in the frontmatter (drafts are hidden in production) - Verify required frontmatter fields (
title,description,pubDate) - Restart the dev server
Images in blog posts not loading
Section titled “Images in blog posts not loading”Symptom: Blog post images show broken image icons.
Solution:
- Place images in
public/assets/blog/and reference them as/assets/blog/image.png - Or place them in
src/assets/and import them for Astro optimization - Do not use relative paths like
./image.pngin Markdown content
Performance issues
Section titled “Performance issues”Lighthouse reports low performance score
Section titled “Lighthouse reports low performance score”Solution:
- Use Astro’s
<Image>component for raster images (fromsrc/assets/) - Avoid adding unnecessary JavaScript to marketing pages
- Preload critical fonts (already done in
MarketingLayout.astro) - Use WebP or AVIF formats for images
- Minimize third-party scripts — use Partytown for non-essential scripts
Getting help
Section titled “Getting help”If you encounter an issue not covered here:
- Search existing GitHub issues
- Check the Astro documentation for framework-specific questions
- Open a new issue with reproduction steps, your Node version, and the error message
- Follow @yethikrishnar on Instagram for updates
Next steps
Section titled “Next steps”- Review the deployment guide for platform-specific setup
- Check integrations for adapter configuration
- Browse the components reference for usage examples