nuxt: Nuxt can't start the app in production on windows

Environment


  • Operating System: Windows_NT
  • Node Version: v18.16.0
  • Nuxt Version: 3.8.0
  • CLI Version: 3.10.0
  • Nitro Version: 2.7.2
  • Package Manager: npm@9.6.5
  • Builder: -
  • User Config: devtools
  • Runtime Modules: -
  • Build Modules: -

Reproduction

  1. Create a new project using npx nuxi@latest init NuxtTest (doesn’t matter which package manager)
  2. Build the app
  3. Run the app
  4. Go to localhost:3000
  5. Receive error

For reference: https://github.com/GalacticHypernova/NuxtFailTest

Describe the bug

There appears to be an issue with the server-renderer module not being found which causes any project (even just the starter template with no change whatsoever) to instantly break on production.

Additional context

The template in https://nuxt.new works fine, so I’m guessing it’s a Windows only issue.

Logs

[nuxt] [request error] [unhandled] [500] Cannot find module 'NuxtFailTest\.output\server\node_modules\vue\server-renderer\index.mjs' imported from \NuxtFailTest\.output\server\chunks\handlers\renderer.mjs
  at new NodeError (node:internal/errors:399:5)
  at finalizeResolution (node:internal/modules/esm/resolve:326:11)
  at moduleResolve (node:internal/modules/esm/resolve:945:10)
  at defaultResolve (node:internal/modules/esm/resolve:1153:11)
  at nextResolve (node:internal/modules/esm/loader:163:28)
  at ESMLoader.resolve (node:internal/modules/esm/loader:838:30)
  at ESMLoader.getModuleJob (node:internal/modules/esm/loader:424:18)
  at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:77:40)
  at link (node:internal/modules/esm/module_job:76:36)

About this issue

  • Original URL
  • State: closed
  • Created 7 months ago
  • Comments: 16 (13 by maintainers)

Most upvoted comments

To anyone who may receive this error in the future: Sometimes this happens due to misconfigured global packages (usually inside the %USERPROFILE% path). Removing everything related to node modules and your package manager there would fix it. (Did for me). A good way to know if you’re affected is by seeing if there’s a .nuxtrc file inside that path if you haven’t initiated a project there.