Nuxt instance unavailable on all pages
See original GitHub issueEnvironment
- Operating System:
Darwin
- Node Version:
v16.14.0
- Nuxt Version:
2.15.8
- Package Manager:
yarn@1.22.17
- Builder:
webpack
- User Config:
modules
,buildModules
,dev
,build
,css
,meta
,app
,runtimeConfig
- Runtime Modules:
@nuxtjs/sitemap@2.4.0
- Build Modules:
nuxt-purgecss@1.0.0
,~/modules/pages
Reproduction
Start dev environment via yarn dev
Describe the bug
On every page I get the error
nuxt instance unavailable
at useNuxtApp (./.nuxt/dist/server/server.mjs:587:13)
at Module.useRuntimeConfig (./.nuxt/dist/server/server.mjs:595:10)
at $id_bbf8dc5e (./.nuxt/dist/server/server.mjs:41284:38)
at async __instantiateModule__ (./.nuxt/dist/server/server.mjs:42697:3)
Additional context
I use useNuxtApp in app.vue
./app.vue
const nuxtApp = useNuxtApp()
nuxtApp.hook('page:finish', () => {
window.scrollTo(0, 0)
})
Logs
No response
Issue Analytics
- State:
- Created a year ago
- Comments:26 (9 by maintainers)
Top Results From Across the Web
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 >Commands and Deployment - Nuxt
Nuxt comes with a set of useful commands, both for development and production purpose.
Read more >Creating Server-side Rendered Vue.js Apps Using Nuxt.js
Nuxt scans the Vue files in the pages directory and outputs the appropriate pages. ... your app on the Vue instance and be...
Read more >Error handling · Get Started with Nuxt
Rendering an Error Page ... When Nuxt encounters a fatal error, whether during the server lifecycle, or when rendering your Vue application (both...
Read more >Using Modules and Pinia to structure Nuxt 3 app
These modules can contain their own components, composables, pages, plugins, and even a server middleware. By having all this modular ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’ve identified two problems and the error is now fixed
moved inside function solved the error
If you have any imports in your component file from
nuxt/app
or#app
, you can remove them, try to run the app and also generate it again to see if the error is gone.