core
core copied to clipboard
Production fails with new setup.
Describe the bug A new setup with any vue components in the pages directory fails when run on nuxthub (seems to be an issue related to the release of vue 3.5) with the following error:
GET 500 /
[nuxt] [request error] [unhandled] [500],global is not defined
at chunks/build/server.mjs:1:162352
[nuxt] [request error] [unhandled] [500],Cannot access 'default' before initialization
at chunks/routes/renderer.mjs:1:119662
at async chunks/routes/renderer.mjs:1:119615
at async chunks/routes/renderer.mjs:1:121753
at async Object.handler (chunks/routes/renderer.mjs:1:120774)
at async Object.handler (chunks/runtime.mjs:1:72242)
at async chunks/runtime.mjs:1:75379
at async chunks/runtime.mjs:1:107021
at async errorHandler (chunks/runtime.mjs:1:102964)
at async chunks/runtime.mjs:1:75531
at async chunks/runtime.mjs:1:107021
Steps to reproduce
- Setup a new nuxt project with
npx nuxi init - Replace the
<NuxtWelcome />component with a<NuxtPage />component in theapp.vuefile. - Add an
index.vuefile in thepages/directory with any content. - Push to github repo.
- Deploy on NuxtHub using the admin panel at admin.hub.nuxt.com by linking to github repo.
- Attempt to visit the deployed site and check the production logs.
Expected behavior No error should be thrown
ps - Error is present regardless of whether the NuxtHub module is present, so this is likely an error on the nitro side of things (?) but since it's related to NuxtHub, I figured it made sense to post it here. But please let me know if I should remove the issue and recreate it on the nitro repo instead!
pps - here is a reproduction repo: https://github.com/howardah/nuxthub-error-reproduction which is deployed here: nuxthub-error-reproduction.nuxt.dev
We need to update our templates since the latest version of Nuxt.
Could you please install vue-router as dependency?
pnpm add vue-router
And confirm it works?
@atinux, sorry for the slow reply here, I've been away from it all day. I can confirm that adding vue-router as a dependency resolves the error!
Ran into the same issue trying to deploy my project (running Nuxt 3.13.0), adding the vue-router dep fixed it for me as well!
Nuxthub is looking great, can't wait to move all my projects from Vercel to the hub 🔥
Cannot get it to work with vue-router.
I am using npm instead of pnpm.
npm install vue-router.
Do I miss anything?
"dependencies": {
"@nuxt/eslint": "^0.5.6",
"@nuxthub/core": "^0.7.10",
"nuxt": "^3.13.0",
"vue-router": "^4.4.3"
},
Try to install vue-router and vue as well @fabianwohlfart
Related Nuxt PR: https://github.com/nuxt/nuxt/pull/28846
Another solution is to have a .npmrc:
# .npmrc
shamefully-hoist=true
And install the dependencies again.
~~Works, thanks.~~ (edited)
Does not work.
I think I stay with patch-package for now…
Would I need to do this workaround with the next Nuxt patch 3.13.2?
Could you please try now with Nuxt 3.13.2?
Could you please try now with Nuxt 3.13.2?
It's in production now and i have no staging set up, so I would need a proper timeframe to test it again. Maybe within the next two weeks. Sorry that I cannot be quicker with this.