index.html not created when running npm run generate
// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
compatibilityDate: '2025-07-15',
devtools: { enabled: true },
srcDir: './app',
app: {
baseURL: '/testing',
buildAssetsDir: '/_nuxt/',
head: {
title: 'biostickies – Gesunde Bio-Leckerlis',
meta: [
{ name: 'description', content: 'Zertifizierte Bio-Pferdeleckerlis ohne Melasse und Getreide, ohne Zuckerzusatz. Perfekt fürs Training, als Belohnung und gesunder Snack für zwischendurch.' },
],
},
},
// Enable error page handling
ssr: true,
nitro: {
experimental: {
wasm: true
},
routeRules: {
'/testing/': { ssr: true },
'/': { prerender: false }
},
publicAssets: [{
baseURL: '/testing/_nuxt/',
dir: 'public'
}]
},
router: {
options: {
strict: false
}
},
modules: ['@nuxt/icon']
})
I do not understand why this is happening, npm run build also doesn't generate the static file
2 Replies
Hi @diez. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
Based on your configuration and the knowledge sources, I can see the issue. You're running
npm run generate but your Nuxt configuration is preventing prerendering.
The Problem
In your nuxt.config.ts, you have:
The '/**': { prerender: false } rule is explicitly disabling prerendering for all routes, which means npm run generate won't create static HTML files.
The Solution
According to the knowledge sources, when you want to generate static files, you need to configure prerendering properly. Based on How to make Nuxt 3 correctly build SSG pages + dynamic API routes?, you should configure the Nitro prerender settings:
Remove the '/**': { prerender: false } rule, as it's preventing the generation of static files.
Additional Context
The knowledge sources show that:
- nuxt build generates server-side rendering capabilities but doesn't prerender pages by default
- nuxt generate is designed to prerender pages, but it respects your route rules configuration
If you want a hybrid approach with both static pages and dynamic server routes, you can use the configuration pattern shown in the Stack Overflow answer to specify which routes should be prerendered and which should remain dynamic.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@276891380243234817> Kapa.ai is still learning and improving, please let me know how I did by reacting below.