Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Nuxt 4.4.7 node-server output packages incomplete [email protected] #35256

Description

@StirStudios

Environment

  • Nuxt version: 4.4.7
  • Nitro preset: node-server
  • Package manager: [email protected]
  • Runtime: Node v22.22.3
  • Deployment: built on server, run with node .output/server/index.mjs via PM2

Describe the bug

After upgrading to Nuxt 4.4.7, the production server build completes successfully, but the deployed app returns a runtime 500 on SSR requests.

Runtime error:

Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/home/stir-project/htdocs/releases/20260602185622/.output/server/node_modules/unhead/dist/server.mjs' imported from /home/stir-project/htdocs/releases/20260602185622/.output/server/chunks/routes/renderer.mjs

The generated renderer imports unhead/server:

import { createHead, propsToString, renderSSRHead } from 'unhead/server'

But the packaged server output contains an incomplete [email protected] package:

.output/server/node_modules/unhead -> .nitro/[email protected]

And inside the packaged dist directory only these files are present:

.output/server/node_modules/unhead/dist/scripts.mjs
.output/server/node_modules/unhead/dist/shared/

Missing files include:

.output/server/node_modules/unhead/dist/server.mjs
.output/server/node_modules/unhead/dist/index.mjs
.output/server/node_modules/unhead/dist/plugins.mjs
.output/server/node_modules/unhead/dist/utils.mjs

However, .output/server/node_modules/unhead/package.json still exposes:

{
  "./server": {
    "types": "./dist/server.d.ts",
    "default": "./dist/server.mjs"
  }
}

So Node resolves unhead/server to a file that does not exist in the generated server output.

Reproduction details

We have not yet reduced this to a minimal public reproduction, but this is consistently reproducible in our production deploy after the Nuxt 4.4.7 update.

The build itself reports success:

✔ Nuxt Nitro server built
✨ Build complete!

But runtime SSR requests fail with the missing module error above.

Workaround

Pinning/overriding Nuxt back to 4.4.6 fixes the generated .output for us.

With Nuxt 4.4.6:

output unhead 2.1.15
output server.mjs OK

The generated output includes:

.output/server/node_modules/unhead/dist/server.mjs
.output/server/node_modules/unhead/dist/index.mjs
.output/server/node_modules/unhead/dist/plugins.mjs
.output/server/node_modules/unhead/dist/utils.mjs

So our current workaround is to pin Nuxt to 4.4.6 until this is resolved.

Expected behavior

The node-server production output should include all files referenced by package exports used by the generated renderer, especially unhead/server -> dist/server.mjs.

Actual behavior

Nuxt 4.4.7 generates a server output that references unhead/server, packages [email protected], but only includes a partial dist directory. This causes runtime SSR requests to fail with ERR_MODULE_NOT_FOUND.

Metadata

Metadata

Assignees

No one assigned

    Type

    Fields

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions