question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

nuxt instance unavailable at useNuxtApp

See original GitHub issue

Environment

  • Operating System: MacOS Big Sur 11.5.2
  • Node Version: v16.15.0
  • Nuxt Version: v3.0.0-rc.4
  • Package Manager: yarn@1.22.18
  • Builder: vite
  • User Config: buildModules, srcDir, runtimeConfig
  • Runtime Modules: -
  • Build Modules: -

Reproduction

https://github.com/mogi86/study-nuxt3/tree/v0.0.3

Describe the bug

No error occurs when yarn dev is executed. However, when yarn preview is executed after yarn build, the following error occurs. Am I using useNuxtApp incorrectly?

Additional context

No response

Logs

yarn run v1.22.18
$ nuxt preview
Nuxt CLI v3.0.0-rc.4                                                                                                                                                                                                                                                  12:53:06
ℹ Node.js version: 16.15.0                                                                                                                                                                                                                                            12:53:06
ℹ Preset: node-server                                                                                                                                                                                                                                                 12:53:06
ℹ Working dir: .output                                                                                                                                                                                                                                                12:53:06
ℹ Starting preview command: node ./server/index.mjs                                                                                                                                                                                                                   12:53:06
                                                                                                                                                                                                                                                                      12:53:06
Listening on http://0.0.0.0:3000/
Error: nuxt instance unavailable
    at useNuxtApp (file:///path/to/study-nuxt3/.output/server/node_modules/nuxt/dist/app/nuxt.mjs:119:13)
    at setup (file:///path/to/study-nuxt3/.output/server/chunks/app/server.mjs:3731:20)
    at _sfc_main$g.setup (file:///path/to/study-nuxt3/.output/server/chunks/app/server.mjs:3756:25)
    at callWithErrorHandling (file:///path/to/study-nuxt3/.output/server/chunks/handlers/renderer.mjs:2536:23)
    at setupStatefulComponent (file:///path/to/study-nuxt3/.output/server/chunks/handlers/renderer.mjs:8182:30)
    at setupComponent (file:///path/to/study-nuxt3/.output/server/chunks/handlers/renderer.mjs:8163:12)
    at renderComponentVNode (file:///path/to/study-nuxt3/.output/server/chunks/handlers/renderer.mjs:10510:17)
    at Object.ssrRenderComponent (file:///path/to/study-nuxt3/.output/server/chunks/handlers/renderer.mjs:10946:12)
    at _sfc_ssrRender (file:///path/to/study-nuxt3/.output/server/chunks/app/server.mjs:4440:32)
    at renderComponentSubTree (file:///path/to/study-nuxt3/.output/server/chunks/handlers/renderer.mjs:10591:13)
[nuxt] [request error] nuxt instance unavailable
  at useNuxtApp (./server/node_modules/nuxt/dist/app/nuxt.mjs:119:13)
  at setup (./server/chunks/app/server.mjs:3731:20)
  at _sfc_main$g.setup (./server/chunks/app/server.mjs:3756:25)
  at callWithErrorHandling (./server/chunks/handlers/renderer.mjs:2536:23)
  at setupStatefulComponent (./server/chunks/handlers/renderer.mjs:8182:30)
  at setupComponent (./server/chunks/handlers/renderer.mjs:8163:12)
  at renderComponentVNode (./server/chunks/handlers/renderer.mjs:10510:17)
  at Object.ssrRenderComponent (./server/chunks/handlers/renderer.mjs:10946:12)
  at _sfc_ssrRender (./server/chunks/app/server.mjs:4440:32)
  at renderComponentSubTree (./server/chunks/handlers/renderer.mjs:10591:13)
[nitro] [dev] [unhandledRejection] TypeError: $setup.hello is not a function

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
Rigo-mcommented, Jun 27, 2022

Can you close the issue then?

0reactions
mogi86commented, Jun 27, 2022

Can you close the issue then?

Yes, I can close. Thank you for your support.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Nuxt instance unavailable on all pages · Issue #4287 - GitHub
I get error nuxt instance unavailable when play with i18n config, properties seo: false or strategy: 'prefix'. [nitro] [dev] [unhandledRejection] ...
Read more >
Nuxt Instance Unavailable throw error - StackBlitz
Editor Preview Both. Sign in. Project. Search. Ports in use. Settings. Switch to Light Theme. Enter Zen Mode. Project. Download Project. Info. Nuxt...
Read more >
FATAL Nuxt instance is unavailable - Stack Overflow
I've just pulled from repo, ran npm install and then i run npm run dev now i get the error FATAL Nuxt instance...
Read more >
NuxtApp · Nuxt Advanced
In Nuxt 3, you can access runtime app context within composables, components and ... const nuxtApp = useNuxtApp() // access runtime nuxt app...
Read more >
The context - Nuxt
The root Vue instance options that includes all your plugins. ... Vue Router route instance. ... Not available via nuxt generate .
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found