-
Notifications
You must be signed in to change notification settings - Fork 79
Description
What version of @astrojs/compiler
are you using?
2.12.2
What package manager are you using?
npm
What operating system are you using?
windows
Describe the Bug
What is the bug?
I am experiencing a persistent, critical compiler bug on my Windows 11 machine that makes Astro completely unusable for my project. The development server will not start and consistently throws a low-level panic
error.
The Error Messages
The primary crash is a Go panic: panic: html: bad parser state: originalIM was set twice
This results in the user-facing error: UnknownCompilerError: Cannot read properties of undefined (reading 'exports')
.
The error always points to my src/layouts/Layout.astro
file, but the trigger seems to be the CSS import.
What I Have Tried (Everything)
I have worked extensively with an AI assistant to solve this, and we have tried every possible solution. The bug still remains. We have tried:
- Creating a brand new, empty Astro project. The error still happens as soon as I try to build my layout.
- Completely uninstalling Node.js, manually deleting all
npm
andnpm-cache
folders from%appdata%
, and reinstalling the latest Node.js LTS version. The bug remains. - Cleaning the npm cache with
npm cache clean --force
. - Moving the project to a path with no spaces (e.g.,
C:/dev/project
). - Recreating the
Layout.astro
file from scratch with minimal code. - Isolating the trigger:
- A bare-bones
Layout.astro
file without any imports works. - The server crashes as soon as I add the line
import "../styles/global.css";
to the layout. - We found and fixed a syntax error in the
global.css
file, but thepanic
still occurs when importing the corrected CSS file.
- A bare-bones
Conclusion
There is a fundamental incompatibility between the Astro WASM compiler and something within my project's CSS file or dependency graph that is causing a non-recoverable crash. The tool is failing at a level that is impossible for me to debug further. My project is currently completely blocked. Please help.
Link to Minimal Reproducible Example
Cannot reproduce online. Bug is local to my Windows machine. See steps in description.