Bottom Line: It is 100% safe to delete the .astro folder. Running npx astro sync or wiping .astro will not delete your site content, components (.astro), or pages.
What is the .astro Folder?
Located in the root of web application projects built with the Astro Web Framework (at .astro), this folder is automatically generated by Astro.
Astro uses .astro to store:
- Content Collection Types (
types.d.ts): Generated TypeScript type definitions for Markdown, MDX, and YAML content schemas. - Vite Transpiler Cache: Fast compilation caches for components and content pages.
If Astro content collection schemas update or Astro throws Type '...' is not assignable to type errors, stale files in .astro are often responsible.
Can You Delete .astro?
✅ Yes, it is completely safe to delete.
- Zero source code lost: Your
src/files, markdown content,astro.config.mjs, andpackage.jsonare 100% safe. - Auto-regenerated: Running
npm run devornpx astro syncwill recreate.astroautomatically in seconds.
How to Safely Clean Up Astro Cache
Method 1: Delete via Terminal Command
Navigate to your Astro project root directory and run:
# macOS / Linux
rm -rf .astro
# Windows (Command Prompt)
rmdir /s /q .astro
# Windows (PowerShell)
Remove-Item -Recurse -Force .astro
Method 2: Regenerate Content Collection Types
npx astro sync
Related Guides
- Learn about deleting Vite cache.
- How to clean up Next.js cache.
- Check if you can clean node_modules.
Discussion
Loading authentication...