Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting 500 Error when Building The App with Nuxt version >=v3.10.0 #26693

Closed
medaminefh opened this issue Apr 8, 2024 · 11 comments
Closed

Getting 500 Error when Building The App with Nuxt version >=v3.10.0 #26693

medaminefh opened this issue Apr 8, 2024 · 11 comments

Comments

@medaminefh
Copy link

medaminefh commented Apr 8, 2024

PS: It's working on development!

Environment

  • Operating System: Linux
  • Node Version: v20.11.1
  • Nuxt Version: 3.11.2
  • CLI Version: 3.11.1
  • Nitro Version: 2.9.6
  • Package Manager: pnpm@8.15.6
  • Builder: -
  • User Config: devtools, runtimeConfig, modules, colorMode, ui
  • Runtime Modules: @nuxt/ui@2.15.1, @pinia/nuxt@0.5.1, @pinia-plugin-persistedstate/nuxt@1.2.0, @nuxt/image@1.5.0
  • Build Modules: -

Reproduction

https://github.com/medaminefh/E-commerce_nuxt_ts

Describe the bug

The error when I upgraded Nuxt & NuxtUi to the latest versions, the deployed app is crashed

500error

Additional context

No response

Logs

I built it and run it locally with nuxt build && nuxt start

[nuxt] [request error] [unhandled] [500] Cannot find module '/home/medaminefh/Desktop/workspace/github.com/alx-projects/E-commerce_nuxt_ts/.output/server/node_modules/vue/server-renderer/index.mjs' imported from /home/medaminefh/Desktop/workspace/github.com/alx-projects/E-commerce_nuxt_ts/.output/server/chunks/routes/renderer.mjs
  at finalizeResolution (node:internal/modules/esm/resolve:264:11)  
  at moduleResolve (node:internal/modules/esm/resolve:917:10)  
  at defaultResolve (node:internal/modules/esm/resolve:1130:11)  
  at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:396:12)  
  at ModuleLoader.resolve (node:internal/modules/esm/loader:365:25)  
  at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:240:38)  
  at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:85:39)  
  at link (node:internal/modules/esm/module_job:84:36)
[nuxt] [request error] [unhandled] [500] Cannot find module '/home/medaminefh/Desktop/workspace/github.com/alx-projects/E-commerce_nuxt_ts/.output/server/node_modules/vue/server-renderer/index.mjs' imported from /home/medaminefh/Desktop/workspace/github.com/alx-projects/E-commerce_nuxt_ts/.output/server/chunks/routes/renderer.mjs
  at finalizeResolution (node:internal/modules/esm/resolve:264:11)  
  at moduleResolve (node:internal/modules/esm/resolve:917:10)  
  at defaultResolve (node:internal/modules/esm/resolve:1130:11)  
  at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:396:12)  
  at ModuleLoader.resolve (node:internal/modules/esm/loader:365:25)  
  at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:240:38)  
  at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:85:39)  
  at link (node:internal/modules/esm/module_job:84:36)
[nuxt] [request error] [unhandled] [500] Cannot find module '/home/medaminefh/Desktop/workspace/github.com/alx-projects/E-commerce_nuxt_ts/.output/server/node_modules/vue/server-renderer/index.mjs' imported from /home/medaminefh/Desktop/workspace/github.com/alx-projects/E-commerce_nuxt_ts/.output/server/chunks/routes/renderer.mjs
  at finalizeResolution (node:internal/modules/esm/resolve:264:11)  
  at moduleResolve (node:internal/modules/esm/resolve:917:10)  
  at defaultResolve (node:internal/modules/esm/resolve:1130:11)  
  at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:396:12)  
  at ModuleLoader.resolve (node:internal/modules/esm/loader:365:25)  
  at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:240:38)  
  at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:85:39)  
  at link (node:internal/modules/esm/module_job:84:36)

No response

@medaminefh medaminefh changed the title Getting 500 Error when upgrading Nuxt v3.10.0 on vercel Getting 500 Error when upgrading Nuxt version to v3.10.0 on vercel Apr 9, 2024
@medaminefh medaminefh changed the title Getting 500 Error when upgrading Nuxt version to v3.10.0 on vercel Getting 500 Error when Building The App with Nuxt version >=v3.10.0 Apr 9, 2024
@warflash
Copy link
Member

warflash commented Apr 9, 2024

Try upgrading your vue version. -> https://stackblitz.com/edit/github-uwezfu?file=package.json

@medaminefh
Copy link
Author

Thank you so much @warflash 🚀

@diffetruction
Copy link

diffetruction commented Apr 26, 2024

Sorry that I necro this issue, but I have the exact same problem

Cannot find module '[...]/.output/server/node_modules/vue/server-renderer/index.mjs' imported from [...]/.output/server/chunks/routes/renderer.mjs

with

    "@nuxtjs/i18n": "^8.2.0",
    "@pinia/nuxt": "^0.5.1",
    "nuxt": "^3.11.2",
    "pinia": "^2.1.7",
    "vue": "^3.4.25",
    "vue-router": "^4.3.0"

Besides that, I can find the server-renderer package in

.output/server/node_modules/vue-router/node_modules/vue/server-renderer

not under

.output/server/node_modules/vue/node_modules/vue/server-renderer

@medaminefh
Copy link
Author

Try to remove the package-lock.json and node_modules and reinstall

@diffetruction
Copy link

Thank you @medaminefh. I did, multiple times. Did not help.

@medaminefh
Copy link
Author

@diffetruction could you create a minimal reproduction

@diffetruction
Copy link

diffetruction commented Apr 27, 2024

@medaminefh I am working on a minimal reproduction (https://stackblitz.com/edit/github-h71f88), but since I got pretty far into it (installing all dependencies, adding the nuxt config, including some fake building blocks) and I can't reproduce the issue just yet, it seems that there must be something wrong with our projects logic, and not with the setup itself.

It is strange, though, that the error hints at a fundamental issue with how the build is produced (at least, as I am able to comprehend it)

I guess, I can only go through the project piece by piece and switch stuff off and on until it changes something. Or do you have another educated guess to offer, maybe?

Appreciate your time and effort <3

@medaminefh
Copy link
Author

medaminefh commented Apr 27, 2024

@diffetruction Honestly I faced that issue before and that was due to upgrading some deps versions, maybe if you look closer at the recently upgraded dependencies it might depend on other dependencies.

[EDIT]: from the package.json file you created I can see that you're using pinia/nuxt and pinia, no need for both you can delete pinia and reinstall everything (might help hopefully)

@diffetruction
Copy link

@medaminefh thank you again for taking the time! Regarding pinia, the docs say otherwise

https://pinia.vuejs.org/ssr/nuxt.html

yarn add pinia @pinia/nuxt
# or with npm
npm install pinia @pinia/nuxt

But your hint to dependency version might be on spot, since I did update some packages a short while ago and (I know, I know) didn't test the build immediatly afterwards...

@medaminefh
Copy link
Author

@diffetruction I installed Pinia using the Nuxt dev tools and it didn't include the pinia dep in package.json, Hemm weird

@diffetruction
Copy link

@medaminefh That is indeed strange. It seems to work either way.

Anyways, I had to wipe the project and clone it anew from origin, that solved my issue. I am a bit confused since I always rm -rf everything I thought could have been related, like package-lock.json, node_modules, .nuxt and .ouput. But at least the problem is gone now.

Thank you again @medaminefh for taking the time, I deeply appreciate it. Case closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants