router icon indicating copy to clipboard operation
router copied to clipboard

Tanstack Start prerender error

Open hehehai opened this issue 1 month ago β€’ 15 comments

Which project does this relate to?

Start

Describe the bug

repo: https://github.com/hehehai/tiny-svg site: https://tiny-svg.actnow.dev/

locale dev: success locale build: error message (prerender)

vite config

import contentCollections from "@content-collections/vite";
import tailwindcss from "@tailwindcss/vite";
import { tanstackStart } from "@tanstack/react-start/plugin/vite";
import viteReact from "@vitejs/plugin-react";
import { Locales } from "intlayer";
import { nitro } from "nitro/vite";
import { defineConfig } from "vite";
import { intlayer, intlayerMiddleware } from "vite-intlayer";
import { VitePWA } from "vite-plugin-pwa";
import tsconfigPaths from "vite-tsconfig-paths";

// PWA runtime caching patterns
const GOOGLE_FONTS_PATTERN = /^https:\/\/fonts\.googleapis\.com\/.*/i;
const GSTATIC_FONTS_PATTERN = /^https:\/\/fonts\.gstatic\.com\/.*/i;

export default defineConfig(({ mode }) => ({
  plugins: [
    contentCollections(),
    intlayer(),
    intlayerMiddleware(),
    tsconfigPaths(),
    tanstackStart({
      sitemap: {
        host: process.env.VERCEL_URL
          ? `https://${process.env.VERCEL_URL}`
          : "http://localhost:3001",
      },
      prerender: {
        // Only enable static pre-rendering in production builds
        enabled: mode === "production",

        // Extract and prerender links found in HTML
        crawlLinks: true,

        // Filter which routes to prerender
        // Only prerender about and blog pages in production
        filter: ({ path }) => {
          // Prerender about page for all locales
          if (path.includes("/about")) {
            return true;
          }

          // Prerender blog list and detail pages for all locales
          if (path.includes("/blog")) {
            return true;
          }

          // Don't prerender other pages (like /optimize which has dynamic functionality)
          return false;
        },
        failOnError: false,
      },
      pages: [
        ...[
          Locales.ENGLISH,
          Locales.CHINESE,
          Locales.KOREAN,
          Locales.GERMAN,
        ].map((locale) => ({
          path: `/${locale}/blog`,
          prerender: { enabled: true },
        })),
      ],
    }),
    nitro(),
    viteReact({
      babel: {
        plugins: ["babel-plugin-react-compiler"],
      },
    }),
    tailwindcss(),
    ...VitePWA({
      registerType: "prompt", // User-controlled updates
      includeAssets: ["*.png", "*.svg", "robots.txt", "sitemap.xml"],
      manifest: false, // Use existing site.webmanifest
      workbox: {
        globPatterns: ["**/*.{js,css,html,png,svg,ico,woff2}"],
        runtimeCaching: [
          {
            urlPattern: GOOGLE_FONTS_PATTERN,
            handler: "CacheFirst",
            options: {
              cacheName: "google-fonts-cache",
              expiration: {
                maxEntries: 10,
                maxAgeSeconds: 60 * 60 * 24 * 365, // 1 year
              },
              cacheableResponse: {
                statuses: [0, 200],
              },
            },
          },
          {
            urlPattern: GSTATIC_FONTS_PATTERN,
            handler: "CacheFirst",
            options: {
              cacheName: "gstatic-fonts-cache",
              expiration: {
                maxEntries: 10,
                maxAgeSeconds: 60 * 60 * 24 * 365, // 1 year
              },
              cacheableResponse: {
                statuses: [0, 200],
              },
            },
          },
        ],
        navigateFallback: null, // TanStack Start handles routing
        skipWaiting: false, // User-controlled updates
        clientsClaim: false,
      },
      devOptions: {
        enabled: false, // Disable in dev for faster iteration
      },
    }),
  ],
  ssr: {
    external: ["@takumi-rs/image-response"],
  },
  optimizeDeps: {
    exclude: ["@takumi-rs/image-response"],
  },
  build: {
    rollupOptions: {
      output: {
        manualChunks(id) {
          // Shiki - syntax highlighting (~300KB)
          if (id.includes("shiki")) {
            return "shiki";
          }
          // Prettier - large dependency (~1.2MB with parsers)
          if (
            id.includes("prettier/standalone") ||
            id.includes("prettier/plugins")
          ) {
            return "prettier";
          }
          // SVGO - only in workers, exclude from main bundle
          if (id.includes("svgo") && !id.includes(".worker")) {
            return "svgo";
          }
          // Radix UI components
          if (id.includes("@radix-ui")) {
            return "ui";
          }
        },
      },
    },
  },
}));

build error console

> vite build

Starting content-collections with config content-collections.ts
vite v7.2.4 building client environment for production...
Start initial build
build started ...
[intlayer]  Preparing Intlayer (v6.1.6)
[intlayer]  βœ“ Local content: 8/8
... finished build of 1 collection and 36 documents in 162ms
[intlayer]  Dictionaries built (160ms)
transforming (1810) src/lib/svgo-plugins.ts[BABEL] Note: The code generator has deoptimised the styling of /Users/guanwei/x/doit/tiny-svg/apps/web/.content-collections/generated/allPosts.js as it exceeds the max of 500KB.
[plugin vite:resolve] Module "os" has been externalized for browser compatibility, imported by "/Users/guanwei/x/doit/tiny-svg/node_modules/.pnpm/[email protected]/node_modules/svgo/lib/svgo-node.js". See https://vite.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.
[plugin vite:resolve] Module "fs/promises" has been externalized for browser compatibility, imported by "/Users/guanwei/x/doit/tiny-svg/node_modules/.pnpm/[email protected]/node_modules/svgo/lib/svgo-node.js". See https://vite.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.
[plugin vite:resolve] Module "path" has been externalized for browser compatibility, imported by "/Users/guanwei/x/doit/tiny-svg/node_modules/.pnpm/[email protected]/node_modules/svgo/lib/svgo-node.js". See https://vite.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.
[plugin vite:resolve] Module "url" has been externalized for browser compatibility, imported by "/Users/guanwei/x/doit/tiny-svg/node_modules/.pnpm/[email protected]/node_modules/svgo/lib/svgo-node.js". See https://vite.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.
[plugin vite:resolve] Module "stream" has been externalized for browser compatibility, imported by "/Users/guanwei/x/doit/tiny-svg/node_modules/.pnpm/[email protected]/node_modules/sax/lib/sax.js". See https://vite.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.
[plugin vite:resolve] Module "string_decoder" has been externalized for browser compatibility, imported by "/Users/guanwei/x/doit/tiny-svg/node_modules/.pnpm/[email protected]/node_modules/sax/lib/sax.js". See https://vite.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.
βœ“ 2968 modules transformed.
....

(!) Some chunks are larger than 500 kB after minification. Consider:
- Using dynamic import() to code-split the application
- Use build.rollupOptions.output.manualChunks to improve chunking: https://rollupjs.org/configuration-options/#output-manualchunks
- Adjust chunk size limit for this warning via build.chunkSizeWarningLimit.
βœ“ built in 4.87s

PWA v1.1.0
mode      generateSW
precache  9 entries (0.00 KiB)
files generated
  dist/sw.js
  dist/workbox-21de4c82.js
warnings
  One of the glob patterns doesn't match any files. Please remove or fix the following: {
  "globDirectory": "/Users/guanwei/x/doit/tiny-svg/apps/web/dist",
  "globPattern": "**/*.{js,css,html,png,svg,ico,woff2}",
  "globIgnores": [
    "**/node_modules/**/*",
    "sw.js",
    "workbox-*.js"
  ]
}

vite v7.2.4 building ssr environment for production...
Start initial build
build started ...
[intlayer]  Intlayer prepared
... finished build of 1 collection and 36 documents in 129ms
βœ“ 3083 modules transformed.

βœ“ built in 2.85s

PWA v1.1.0
mode      generateSW
precache  9 entries (0.00 KiB)
files generated
  dist/sw.js
  dist/workbox-21de4c82.js
warnings
  One of the glob patterns doesn't match any files. Please remove or fix the following: {
  "globDirectory": "/Users/guanwei/x/doit/tiny-svg/apps/web/dist",
  "globPattern": "**/*.{js,css,html,png,svg,ico,woff2}",
  "globIgnores": [
    "**/node_modules/**/*",
    "sw.js",
    "workbox-*.js"
  ]
}

[prerender] Prerendering pages...
Starting content-collections with config content-collections.ts
[nitro] No build found. Please build your project before previewing.
[prerender] Concurrency: 10
[prerender] Crawling: /en/blog
[prerender] Crawling: /zh/blog
[prerender] Crawling: /ko/blog
[prerender] Crawling: /de/blog
Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/Users/guanwei/x/doit/tiny-svg/apps/web/dist/server/server.js' imported from /Users/guanwei/x/doit/tiny-svg/node_modules/.pnpm/@[email protected]_@[email protected][email protected]_rea_655f57886a17e7b61fe86aa1b0a9e988/node_modules/@tanstack/start-plugin-core/dist/esm/preview-server-plugin/plugin.js
    at finalizeResolution (node:internal/modules/esm/resolve:274:11)
    at moduleResolve (node:internal/modules/esm/resolve:864:10)
    at defaultResolve (node:internal/modules/esm/resolve:990:11)
    at nextResolve (node:internal/modules/esm/hooks:748:28)
    at o (file:///Users/guanwei/x/doit/tiny-svg/node_modules/.pnpm/@[email protected]/node_modules/@tailwindcss/node/dist/esm-cache.loader.mjs:1:69)
    at nextResolve (node:internal/modules/esm/hooks:748:28)
    at Hooks.resolve (node:internal/modules/esm/hooks:240:30)
    at MessagePort.handleMessage (node:internal/modules/esm/worker:201:24)
    at [nodejs.internal.kHybridDispatch] (node:internal/event_target:827:20)
    at MessagePort.<anonymous> (node:internal/per_context/messageport:23:28)
Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/Users/guanwei/x/doit/tiny-svg/apps/web/dist/server/server.js' imported from /Users/guanwei/x/doit/tiny-svg/node_modules/.pnpm/@[email protected]_@[email protected][email protected]_rea_655f57886a17e7b61fe86aa1b0a9e988/node_modules/@tanstack/start-plugin-core/dist/esm/preview-server-plugin/plugin.js
    at finalizeResolution (node:internal/modules/esm/resolve:274:11)
    at moduleResolve (node:internal/modules/esm/resolve:864:10)
    at defaultResolve (node:internal/modules/esm/resolve:990:11)
    at nextResolve (node:internal/modules/esm/hooks:748:28)
    at o (file:///Users/guanwei/x/doit/tiny-svg/node_modules/.pnpm/@[email protected]/node_modules/@tailwindcss/node/dist/esm-cache.loader.mjs:1:69)
    at nextResolve (node:internal/modules/esm/hooks:748:28)
    at Hooks.resolve (node:internal/modules/esm/hooks:240:30)
    at handleMessage (node:internal/modules/esm/worker:201:24)
    at Immediate.checkForMessages (node:internal/modules/esm/worker:143:28)
    at process.processImmediate (node:internal/timers:505:21)
Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/Users/guanwei/x/doit/tiny-svg/apps/web/dist/server/server.js' imported from /Users/guanwei/x/doit/tiny-svg/node_modules/.pnpm/@[email protected]_@[email protected][email protected]_rea_655f57886a17e7b61fe86aa1b0a9e988/node_modules/@tanstack/start-plugin-core/dist/esm/preview-server-plugin/plugin.js
    at finalizeResolution (node:internal/modules/esm/resolve:274:11)
    at moduleResolve (node:internal/modules/esm/resolve:864:10)
    at defaultResolve (node:internal/modules/esm/resolve:990:11)
    at nextResolve (node:internal/modules/esm/hooks:748:28)
    at o (file:///Users/guanwei/x/doit/tiny-svg/node_modules/.pnpm/@[email protected]/node_modules/@tailwindcss/node/dist/esm-cache.loader.mjs:1:69)
    at nextResolve (node:internal/modules/esm/hooks:748:28)
    at Hooks.resolve (node:internal/modules/esm/hooks:240:30)
    at handleMessage (node:internal/modules/esm/worker:201:24)
    at checkForMessages (node:internal/modules/esm/worker:143:28)
    at process.<anonymous> (node:internal/modules/esm/worker:162:5)
Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/Users/guanwei/x/doit/tiny-svg/apps/web/dist/server/server.js' imported from /Users/guanwei/x/doit/tiny-svg/node_modules/.pnpm/@[email protected]_@[email protected][email protected]_rea_655f57886a17e7b61fe86aa1b0a9e988/node_modules/@tanstack/start-plugin-core/dist/esm/preview-server-plugin/plugin.js
    at finalizeResolution (node:internal/modules/esm/resolve:274:11)
    at moduleResolve (node:internal/modules/esm/resolve:864:10)
    at defaultResolve (node:internal/modules/esm/resolve:990:11)
    at nextResolve (node:internal/modules/esm/hooks:748:28)
    at o (file:///Users/guanwei/x/doit/tiny-svg/node_modules/.pnpm/@[email protected]/node_modules/@tailwindcss/node/dist/esm-cache.loader.mjs:1:69)
    at nextResolve (node:internal/modules/esm/hooks:748:28)
    at Hooks.resolve (node:internal/modules/esm/hooks:240:30)
    at handleMessage (node:internal/modules/esm/worker:201:24)
    at Immediate.checkForMessages (node:internal/modules/esm/worker:143:28)
    at process.processImmediate (node:internal/timers:505:21)
[prerender] Prerendered 0 pages:
[sitemap] Building Sitemap...
[sitemap] Writing sitemap XML at /Users/guanwei/x/doit/tiny-svg/apps/web/.output/public/sitemap.xml
[sitemap] Writing pages data at /Users/guanwei/x/doit/tiny-svg/apps/web/.output/public/pages.json

◐ Building [Nitro] (preset: node-server, compatibility: 2025-11-22)            nitro 10:19:49 AM
βœ” Generated public .output/public                                             nitro 10:19:49 AM
vite v7.2.4 building nitro environment for production...
Start initial build
build started ...
[intlayer]  Intlayer prepared
... finished build of 1 collection and 36 documents in 135ms
βœ“ 102 modules transformed.
....
βœ“ built in 4.48s

PWA v1.1.0
mode      generateSW
precache  9 entries (0.00 KiB)
files generated
  dist/sw.js
  dist/workbox-21de4c82.js
warnings
  One of the glob patterns doesn't match any files. Please remove or fix the following: {
  "globDirectory": "/Users/guanwei/x/doit/tiny-svg/apps/web/dist",
  "globPattern": "**/*.{js,css,html,png,svg,ico,woff2}",
  "globIgnores": [
    "**/node_modules/**/*",
    "sw.js",
    "workbox-*.js"
  ]
}

β„Ή Generated .output/nitro.json                                                      10:19:54 AM

βœ” You can preview this build using node .output/server/index.mjs              nitro 10:19:54 AM

Your Example Website or App

https://tiny-svg.actnow.dev/

Steps to Reproduce the Bug or Issue

  1. pnpm install
  2. pnpm run build

Because failOnError is false, the build process will not be interrupted by an error.

Expected behavior

prerender success, build no error

Screenshots or Videos

No response

Platform

  • "@tanstack/react-start": "^1.132.31"
  • "@tanstack/react-router": "^1.132.31"
  • OS: macOS (deploy vercel same error)
  • Bundler: vite
  • "vite": "^7.0.2"

Additional context

I used PWA, and I'm not sure if this is the cause.

hehehai avatar Nov 22 '25 02:11 hehehai

Can you try bumping to the latest versions of start/router?

birkskyum avatar Nov 22 '25 12:11 birkskyum

Can you try bumping to the latest versions of start/router?

latest version

"@tanstack/react-router": "^1.139.1",
    "@tanstack/react-router-with-query": "^1.130.17",
    "@tanstack/react-start": "^1.139.1",
    "@tanstack/router-plugin": "^1.139.1",
◐ Building [Nitro] (preset: vercel, compatibility: 2025-11-22)                        nitro 11:40:08 PM
AggregateError [ECONNREFUSED]:
    at internalConnectMultiple (node:net:1134:18)
    at afterConnectMultiple (node:net:1715:7)
AggregateError [ECONNREFUSED]:
    at internalConnectMultiple (node:net:1134:18)
    at afterConnectMultiple (node:net:1715:7)
AggregateError [ECONNREFUSED]:
    at internalConnectMultiple (node:net:1134:18)
    at afterConnectMultiple (node:net:1715:7)

hehehai avatar Nov 22 '25 15:11 hehehai

@edmundhung do you understand what's going on here?

birkskyum avatar Nov 22 '25 16:11 birkskyum

It seems like both the client and server build is missing from dist after build, so the preview server plugin fails looking up the server entry and serve any requests.

edmundhung avatar Nov 22 '25 16:11 edmundhung

nitro configures preview server itself. so this should just work. we need to reduce the complexity of this project to identify which part is causing the error

schiller-manuel avatar Nov 22 '25 16:11 schiller-manuel

In my case also get some error when doing prerender and it's failed the process to build the project. This happen on the latest version of Tanstack start and router.

  "@tanstack/react-router": "^1.139.3",
  "@tanstack/react-start": "^1.139.3",
  error during build:
  Error: Failed to start the Vite preview server for prerendering
      at startPreviewServer (file:///Users/nyomansunima/Projects/personal/official-site/node_modules/@tanstack/start-plugin-core/dist/esm/prerender.js:195:11)
      at async prerender (file:///Users/nyomansunima/Projects/personal/official-site/node_modules/@tanstack/start-plugin-core/dist/esm/prerender.js:42:25)
      at async postServerBuild (file:///Users/nyomansunima/Projects/personal/official-site/node_modules/@tanstack/start-plugin-core/dist/esm/post-server-build.js:38:5)
      at async BasicMinimalPluginContext.handler (file:///Users/nyomansunima/Projects/personal/official-site/node_modules/@tanstack/start-plugin-core/dist/esm/plugin.js:267:11)
      at async Object.buildApp (file:///Users/nyomansunima/Projects/personal/official-site/node_modules/vite/dist/node/chunks/config.js:34542:5)
      at async CAC.<anonymous> (file:///Users/nyomansunima/Projects/personal/official-site/node_modules/vite/dist/node/cli.js:629:3)

nyomansunima avatar Nov 23 '25 01:11 nyomansunima

In my case also get some error when doing prerender and it's failed the process to build the project. This happen on the latest version of Tanstack start and router.

"@tanstack/react-router": "^1.139.3", "@tanstack/react-start": "^1.139.3", error during build: Error: Failed to start the Vite preview server for prerendering at startPreviewServer (file:///Users/nyomansunima/Projects/personal/official-site/node_modules/@tanstack/start-plugin-core/dist/esm/prerender.js:195:11) at async prerender (file:///Users/nyomansunima/Projects/personal/official-site/node_modules/@tanstack/start-plugin-core/dist/esm/prerender.js:42:25) at async postServerBuild (file:///Users/nyomansunima/Projects/personal/official-site/node_modules/@tanstack/start-plugin-core/dist/esm/post-server-build.js:38:5) at async BasicMinimalPluginContext.handler (file:///Users/nyomansunima/Projects/personal/official-site/node_modules/@tanstack/start-plugin-core/dist/esm/plugin.js:267:11) at async Object.buildApp (file:///Users/nyomansunima/Projects/personal/official-site/node_modules/vite/dist/node/chunks/config.js:34542:5) at async CAC. (file:///Users/nyomansunima/Projects/personal/official-site/node_modules/vite/dist/node/cli.js:629:3)

also getting this error, reverting to 1.136.18 fixed it

dnnsjsk avatar Nov 23 '25 09:11 dnnsjsk

@dnnsjsk @nyomansunima can you please provide a complete reproducer?

schiller-manuel avatar Nov 23 '25 10:11 schiller-manuel

@schiller-manuel This repo reproduces the error using bothnitro/vite and @tanstack/nitro-v2-vite-plugin

https://github.com/fcannizzaro/tanstack-start-prerender-error-vite

hint: it seems that the error happens when spa mode is enabled

fcannizzaro avatar Nov 23 '25 15:11 fcannizzaro

Can also confirm I'm getting:

Error: Failed to start the Vite preview server for prerendering

when using spa mode on v1.139.2

jose-nullstudio avatar Nov 23 '25 19:11 jose-nullstudio

Can also confirm with tsr v1.139.3 & spa mode enabled.

With nitro v3.0.1-alpha.0 I get this error:

Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/home/mtg/React/my-website/apps/dashboard/dist/server/server.js' imported from /home/mtg/React/my-website/node_modules/.pnpm/@[email protected]_@[email protected][email protected]_rea_00be85f608c0fc9517deed915162bf54/node_modules/@tanstack/start-plugin-core/dist/esm/preview-server-plugin/plugin.js
    at finalizeResolution (node:internal/modules/esm/resolve:275:11)
    at moduleResolve (node:internal/modules/esm/resolve:932:10)
    at defaultResolve (node:internal/modules/esm/resolve:1056:11)
    at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:654:12)
    at #cachedDefaultResolve (node:internal/modules/esm/loader:603:25)
    at ModuleLoader.resolve (node:internal/modules/esm/loader:586:38)
    at ModuleLoader.getModuleJobForImport (node:internal/modules/esm/loader:242:38)
    at onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:546:36)
    at TracingChannel.tracePromise (node:diagnostics_channel:344:14)
    at ModuleLoader.import (node:internal/modules/esm/loader:545:21)
    at defaultImportModuleDynamicallyForModule (node:internal/modules/esm/utils:215:31)
    at importModuleDynamicallyCallback (node:internal/modules/esm/utils:254:12)
    at file:///home/mtg/React/my-website/node_modules/.pnpm/@[email protected]_@[email protected][email protected]_rea_00be85f608c0fc9517deed915162bf54/node_modules/@tanstack/start-plugin-core/dist/esm/preview-server-plugin/plugin.js:26:78
    at call (file:///home/mtg/React/my-website/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected][email protected][email protected]/node_modules/vite/dist/node/chunks/config.js:14065:5)
    at next (file:///home/mtg/React/my-website/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected][email protected][email protected]/node_modules/vite/dist/node/chunks/config.js:14018:4)
    at file:///home/mtg/React/my-website/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected][email protected][email protected]/node_modules/vite/dist/node/chunks/config.js:25752:28
    at viteAssetMiddleware (file:///home/mtg/React/my-website/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected][email protected][email protected]/node_modules/vite/dist/node/chunks/config.js:35361:4)
    at call (file:///home/mtg/React/my-website/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected][email protected][email protected]/node_modules/vite/dist/node/chunks/config.js:14065:5)
    at next (file:///home/mtg/React/my-website/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected][email protected][email protected]/node_modules/vite/dist/node/chunks/config.js:14018:4)
    at file:///home/mtg/React/my-website/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected][email protected][email protected]/node_modules/vite/dist/node/chunks/config.js:35267:3
    at call (file:///home/mtg/React/my-website/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected][email protected][email protected]/node_modules/vite/dist/node/chunks/config.js:14065:5)
    at next (file:///home/mtg/React/my-website/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected][email protected][email protected]/node_modules/vite/dist/node/chunks/config.js:14018:4)
    at hostValidationMiddleware$1$1 (file:///home/mtg/React/my-website/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected][email protected][email protected]/node_modules/vite/dist/node/chunks/config.js:23732:3)
    at call (file:///home/mtg/React/my-website/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected][email protected][email protected]/node_modules/vite/dist/node/chunks/config.js:14065:5)
    at next (file:///home/mtg/React/my-website/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected][email protected][email protected]/node_modules/vite/dist/node/chunks/config.js:14018:4)
    at cors (file:///home/mtg/React/my-website/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected][email protected][email protected]/node_modules/vite/dist/node/chunks/config.js:14358:5)
    at file:///home/mtg/React/my-website/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected][email protected][email protected]/node_modules/vite/dist/node/chunks/config.js:14381:9
    at originCallback (file:///home/mtg/React/my-website/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected][email protected][email protected]/node_modules/vite/dist/node/chunks/config.js:14375:8)
    at file:///home/mtg/React/my-website/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected][email protected][email protected]/node_modules/vite/dist/node/chunks/config.js:14377:27
    at optionsCallback (file:///home/mtg/React/my-website/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected][email protected][email protected]/node_modules/vite/dist/node/chunks/config.js:14365:5)
    at corsMiddleware$2 (file:///home/mtg/React/my-website/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected][email protected][email protected]/node_modules/vite/dist/node/chunks/config.js:14368:5)
    at call (file:///home/mtg/React/my-website/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected][email protected][email protected]/node_modules/vite/dist/node/chunks/config.js:14065:5)
    at next (file:///home/mtg/React/my-website/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected][email protected][email protected]/node_modules/vite/dist/node/chunks/config.js:14018:4)
    at Function.handle (file:///home/mtg/React/my-website/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected][email protected][email protected]/node_modules/vite/dist/node/chunks/config.js:14020:3)
    at Server.app (file:///home/mtg/React/my-website/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected][email protected][email protected]/node_modules/vite/dist/node/chunks/config.js:13927:8)
    at Server.emit (node:events:524:28)
    at parserOnIncoming (node:_http_server:1153:12)
    at HTTPParser.parserOnHeadersComplete (node:_http_common:117:17)
[prerender] Prerendered 0 pages:
[sitemap] Hint: Pages found, but no sitemap host has been set. To enable sitemap generation, set the `sitemap.host` option.

◐ Building [Nitro] (preset: node-server, compatibility: 2025-11-25)                                                                                                               nitro 1:52:35 PM
🐼 error [❌] Error: Failed to fetch /: Internal Server Error
    at file:///home/mtg/React/my-website/node_modules/.pnpm/@[email protected]_@[email protected][email protected]_rea_00be85f608c0fc9517deed915162bf54/node_modules/@tanstack/start-plugin-core/dist/esm/prerender.js:126:19
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
    at async file:///home/mtg/React/my-website/node_modules/.pnpm/@[email protected]_@[email protected][email protected]_rea_00be85f608c0fc9517deed915162bf54/node_modules/@tanstack/start-plugin-core/dist/esm/queue.js:38:17

With nitro v3.0.1-alpha.1 I get this error instead (which seems similar) & the build process fails:


βœ“ built in 1.53s
[prerender] Prerendering pages...
error during build:
Error: Failed to start the Vite preview server for prerendering
    at startPreviewServer (file:///home/mtg/React/my-website/node_modules/.pnpm/@[email protected]_@[email protected][email protected]_rea_ffaa635e8039d940689f3c0d8124be88/node_modules/@tanstack/start-plugin-core/dist/esm/prerender.js:195:11)
    at async prerender (file:///home/mtg/React/my-website/node_modules/.pnpm/@[email protected]_@[email protected][email protected]_rea_ffaa635e8039d940689f3c0d8124be88/node_modules/@tanstack/start-plugin-core/dist/esm/prerender.js:42:25)
    at async postServerBuild (file:///home/mtg/React/my-website/node_modules/.pnpm/@[email protected]_@[email protected][email protected]_rea_ffaa635e8039d940689f3c0d8124be88/node_modules/@tanstack/start-plugin-core/dist/esm/post-server-build.js:38:5)
    at async BasicMinimalPluginContext.handler (file:///home/mtg/React/my-website/node_modules/.pnpm/@[email protected]_@[email protected][email protected]_rea_ffaa635e8039d940689f3c0d8124be88/node_modules/@tanstack/start-plugin-core/dist/esm/plugin.js:267:11)
    at async Object.buildApp (file:///home/mtg/React/my-website/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected][email protected][email protected]/node_modules/vite/dist/node/chunks/config.js:34137:5)
    at async CAC.<anonymous> (file:///home/mtg/React/my-website/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected][email protected][email protected]/node_modules/vite/dist/node/cli.js:629:3)
 ELIFECYCLE  Command failed with exit code 1.

MTG2000 avatar Nov 25 '25 09:11 MTG2000

Same as ##5967

ImSingee avatar Nov 26 '25 02:11 ImSingee

Can also confirm in => 1.139.6

CarlosZiegler avatar Nov 26 '25 08:11 CarlosZiegler

Looks like problem on nitro => https://github.com/TanStack/router/issues/5967#issuecomment-3580018974

CarlosZiegler avatar Nov 26 '25 08:11 CarlosZiegler

Can also confirm in => 1.139.6

It has been upgraded to the latest version, but there is still the same error.

"@tanstack/react-router": "^1.139.14",
"@tanstack/react-router-with-query": "^1.130.17",
"@tanstack/react-start": "^1.139.14",
"@tanstack/router-plugin": "^1.139.14",

hehehai avatar Dec 04 '25 04:12 hehehai