nuxt: __NUXT_ASYNC_CONTEXT__ is not defined
Environment
- Operating System: Windows_NT
- Node Version: v20.10.0
- Nuxt Version: 3.9.0
- CLI Version: 3.10.0
- Nitro Version: 2.8.1
- Package Manager: npm@10.2.3
- Builder: -
- User Config: extends, app, css, components, experimental, typescript, devtools, modules, tailwindcss
- Runtime Modules: @vueuse/nuxt@10.7.0, @uikit/nuxt@1.0.0
- Build Modules: -
Reproduction
Can not reproduce this bug in fresh app.
Describe the bug
After upgrading to nuxt 3.9.0 app does not running in dev mode and the following error occures:
It might be vite 5 related bug, because it seems like notheing else in 3.9.0 could lead to this…
Additional context
I use a monorepo with lerna.
I use this command to start the server:
lerna run dev --scope @apps/app
Logs
[nuxt] [request error] [unhandled] [500] __NUXT_ASYNC_CONTEXT__ is not defined
at C:\OpenServer\domains\kidnapper\frontend\node_modules\nuxt\dist\app\nuxt.js:8:19
at async ViteNodeRunner.directRequest (/C:/OpenServer/domains/kidnapper/frontend/node_modules/vite-node/dist/client.mjs:341:5)
at async ViteNodeRunner.cachedRequest (/C:/OpenServer/domains/kidnapper/frontend/node_modules/vite-node/dist/client.mjs:197:14)
at async ViteNodeRunner.dependencyRequest (/C:/OpenServer/domains/kidnapper/frontend/node_modules/vite-node/dist/client.mjs:231:12)
at async C:\OpenServer\domains\kidnapper\frontend\node_modules\nuxt\dist\app\entry.js:4:31
at async ViteNodeRunner.directRequest (/C:/OpenServer/domains/kidnapper/frontend/node_modules/vite-node/dist/client.mjs:341:5)
at async ViteNodeRunner.cachedRequest (/C:/OpenServer/domains/kidnapper/frontend/node_modules/vite-node/dist/client.mjs:197:14)
at async ViteNodeRunner.executeFile (/C:/OpenServer/domains/kidnapper/frontend/node_modules/vite-node/dist/client.mjs:169:12)
at async default (/C:/OpenServer/domains/kidnapper/frontend/node_modules/@nuxt/vite-builder/dist/runtime/vite-node.mjs:27:67)
at async Object.renderToString (/C:/OpenServer/domains/kidnapper/frontend/node_modules/vue-bundle-renderer/dist/runtime.mjs:173:19)
[nuxt] [request error] [unhandled] [500] __NUXT_ASYNC_CONTEXT__ is not defined
at C:\OpenServer\domains\kidnapper\frontend\node_modules\nuxt\dist\app\nuxt.js:8:19
at async ViteNodeRunner.directRequest (/C:/OpenServer/domains/kidnapper/frontend/node_modules/vite-node/dist/client.mjs:341:5)
at async ViteNodeRunner.cachedRequest (/C:/OpenServer/domains/kidnapper/frontend/node_modules/vite-node/dist/client.mjs:197:14)
at async ViteNodeRunner.dependencyRequest (/C:/OpenServer/domains/kidnapper/frontend/node_modules/vite-node/dist/client.mjs:231:12)
at async C:\OpenServer\domains\kidnapper\frontend\node_modules\nuxt\dist\app\entry.js:4:31
at async ViteNodeRunner.directRequest (/C:/OpenServer/domains/kidnapper/frontend/node_modules/vite-node/dist/client.mjs:341:5)
at async ViteNodeRunner.cachedRequest (/C:/OpenServer/domains/kidnapper/frontend/node_modules/vite-node/dist/client.mjs:197:14)
at async ViteNodeRunner.executeFile (/C:/OpenServer/domains/kidnapper/frontend/node_modules/vite-node/dist/client.mjs:169:12)
at async default (/C:/OpenServer/domains/kidnapper/frontend/node_modules/@nuxt/vite-builder/dist/runtime/vite-node.mjs:27:67)
at async Object.renderToString (/C:/OpenServer/domains/kidnapper/frontend/node_modules/vue-bundle-renderer/dist/runtime.mjs:173:19)
About this issue
- Original URL
- State: closed
- Created 6 months ago
- Reactions: 6
- Comments: 27 (10 by maintainers)
The likely workaround is:
This bug is back in the version 3.10.0(1), in 3.9.3 it`s ok
Yep same issue here after upgrading to the latest version.
Running on mac as well.
@and-ratajski You’re right! Removing
node_modulesfrom the home folder solved it for the friend of mine. Good catch!I’m pretty sure it’s not a Nuxt issue but is triggered by the mismatch of Nuxt/vite versions.
Just got the issue last week.
In addition to all anwsers above, if you’re using pnpm.
Running
pnpm store prunethen reinstalling should also workMy guess is that you have another Nuxt installation under
/Users/<your-user-name>. Try deletingnode_modulesandpackage.jsonwith your package manager’s lock file from there.If that doesn’t help you can try downgrading your Nuxt version to
3.8.2and reinstalling it.Further update:
A reproduction here:
https://stackblitz.com/edit/github-e4atgm?file=app.config.ts
removing
import { defineAppConfig } from '#app/nuxt';from yourapp.config.tsfile seems to also fix this issue.Hi, I personally wasn’t able to replicate this issue, but my friend has been experiencing it on his MacBook. The nuxt schema version is
3.9.0Where should I put the workaround?
Would you check that your
@nuxt/vite-builderversion is also 3.9.0?@leosin Could you please run
npx nuxi infoor list modules that you are using?