How to Fix the “NoAdapterInstalled” Error in Astro Builds
Have you ever suddenly encountered a NoAdapterInstalled
error when trying to build your Astro project? Many people are particularly troubled by cases where “I want to build with static site generation (SSG), but I’m told server-side rendering (SSR) is required.” I hope I’m not the only one.
While this error seems like a small problem at first glance, it can take time to resolve. In this article, I’ll introduce 5 main causes and solutions for the NoAdapterInstalled
error that I’ve actually experienced, in checklist format.
Cause 1: astro.config.* Configuration Error - Checking output Value
When using only SSG
, always set:
export default defineConfig({
output: 'static',
});
I can hear voices saying “I’m already doing that,” but please be careful with:
export default defineConfig({
output: 'hybrid',
});
or
export default defineConfig({
output: 'server',
});
Cause 2: Incorrect Use of prerender = false
Setting
This is a trap. Do you have this line somewhere?
export const prerender = false;
This single line makes that page a target for dynamic generation. Its impact affects the build. How scary.
Cause 3: Missing getStaticPaths()
Method in Dynamic Routes
This is criminal. Having a hierarchy like [...blog]
without preparing for it is deliberate.
Cause 4: API Endpoint SSG Incompatibility Issues
Do you have something like src/pages/api
? Give up, I think that’s impossible with SSG
.
Cause 5: Unnecessary Server Adapter Configuration
Did you accidentally install & use @astrojs/netlify/functions
or @astrojs/vercel/serverless
?
import { defineConfig } from 'astro/config';
import vercel from '@astrojs/vercel/serverless';
export default defineConfig({
output: 'server',
adapter: vercel(),
});
If you have something like this, please remove it.
Real Experience: My Solution to the NoAdapterInstalled Error
In my case, Cause 2 was the problem. I had forgotten to revert a prerender = false
setting that I had added for testing purposes. As a result, even though I had specified output: 'static'
in astro.config.mjs
, it was being overridden by the page-level setting.
The important lesson I learned from this experience is that Astro settings are applied hierarchically. Since global settings (astro.config.*) can be overridden by page-level settings, when build errors occur, always check page-level settings as well.
Summary: NoAdapterInstalled Error Resolution Checklist
When a NoAdapterInstalled
error occurs in your Astro project, try checking the following 5 points in order:
- Check that the
output
setting in astro.config. file* is set to'static'
- Check that no
prerender = false
setting has crept in at the page level - Check that
getStaticPaths()
is implemented for dynamic routing pages - Check that API endpoints are compatible with SSG mode
- Check that no server adapter is mistakenly configured
By checking these points in order, you should be able to identify and resolve the problem in most cases.