Vite "Internal server error" from PostCSS during build in CI
Vite runs CSS through PostCSS. A plugin that is not installed, a config that exports the wrong shape, or invalid CSS makes PostCSS throw, and Vite surfaces it as an internal server error or a build-time CSS failure.
What this error means
The build fails with a PostCSS message such as "Failed to load PostCSS config", "Cannot find module 'tailwindcss'", or "[postcss] ... Unexpected" pointing at a stylesheet.
[vite:css] Failed to load PostCSS config (searchPath: /app): [Error]
Loading PostCSS Plugin failed: Cannot find module 'autoprefixer'
(@/app/postcss.config.js)Common causes
A PostCSS plugin is not installed in CI
A plugin referenced in postcss.config was a devDependency the CI install skipped, so PostCSS cannot load it.
An invalid PostCSS config export
The config exports the wrong shape (for example ESM/CJS mismatch) or references a plugin by the wrong name.
How to fix it
Install the missing PostCSS plugins
- Read which module PostCSS could not load.
- Install it as a real dependency CI keeps.
- Re-run the build so PostCSS resolves every plugin.
npm install -D autoprefixer tailwindcss postcss
npm ciFix the config export shape
Match the config module format to your project so Vite can load it (CommonJS shown).
// postcss.config.cjs
module.exports = { plugins: { autoprefixer: {} } };How to prevent it
- Install PostCSS plugins as dependencies the CI install retains.
- Keep the config module format consistent with your project type.
- Reference plugins by their exact package name.