'Not sure how to preview my generated Nuxt3 app

I've just created a Nuxt3 in static mode but I don't want to push it to Netlify everytime to preview it.

Here is my nuxt.config.js (nothing changed)

import { defineNuxtConfig } from 'nuxt'

export default defineNuxtConfig({
})

Also, I don't know why but yarn generate is not working as you can see below, it says

Preview is not supported for this build

enter image description here

Opening the index.html file directly is not helping because I do have a lot of errors + my API calls are not working.

enter image description here



Solution 1:[1]

If you want to preview your statically generated content, you will still need a light server to serve the assets + handle the API requests etc.
Even host providers like Netlify/Vercel do run a small server to serve static files.

The fastest solution is probably to use serve, you don't have to install it directly on your system (I didn't achieved to make it work myself).

You can run npx serve .output/public to have something working in no time and get a functional preview.

enter image description here

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 kissu