bridge: Error on Startup after Migration to Nuxt Bridge on Fresh Project
Environment
- Operating System:
Darwin - Node Version:
v16.11.0 - Nuxt Version:
2.16.0-27358576.777a4b7f - Package Manager:
yarn@1.22.17 - Bundler:
Webpack - User Config:
target,head,css,plugins,components,buildModules,modules,vuetify,build - Runtime Modules:
- - Build Modules:
@nuxtjs/vuetify@1.12.3
Reproduction
https://github.com/timgoeller/nuxt-bug
Describe the bug
When generating a new empty Nuxt 2 project and applying the steps provided in the Nuxt Bridge getting started guide (https://v3.nuxtjs.org/getting-started/bridge/), calling yarn dev throws an error when using nuxi dev (using nuxt still works).
The error message is as follows:
ERROR Cannot read properties of undefined (reading 'callHook') 16:23:36
at Object.invoke (node_modules/nuxi/dist/chunks/dev.mjs:6773:31)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async _main (node_modules/nuxi/dist/chunks/index.mjs:384:7)
I think it might have to do with this recent change, even though it seems like no one else encountered this issue yet: https://github.com/nuxt/framework/commit/4bd7adae4a7d43f7b906abec1149688d307954a3#diff-86f78f1673e500e055e8a1f266252abe62af18f0b52424f09275d7f2b1e96d3f
Additional context
No response
Logs
yarn run v1.22.17
$ nuxi dev
Nuxt CLI v3.0.0-27386759.b449d0b 16:23:25
16:23:25
> Local: http://localhost:3000/
> Network: http://192.168.0.31:3000/
ℹ Preparing project for development 16:23:28
ℹ Initial build may take a while 16:23:28
ℹ Discovered Components: .nuxt/components/readme.md 16:23:28
✔ Builder initialized 16:23:28
✔ Nuxt files generated 16:23:28
✔ Client
Compiled successfully in 7.54s
✔ Server
Compiled successfully in 6.49s
ℹ Waiting for file changes 16:23:36
ERROR Cannot read properties of undefined (reading 'callHook') 16:23:36
at Object.invoke (node_modules/nuxi/dist/chunks/dev.mjs:6773:31)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async _main (node_modules/nuxi/dist/chunks/index.mjs:384:7)
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 11
- Comments: 15 (3 by maintainers)
If you are still getting this error while debugging your migration process, I encountered severe issues in development and according to the migration guide that says that you can disable Bridge if you set
bridge: falsein your nuxt.config.js file.If you do this, you have to start nuxt with the legacy script, because
nuxi devdoesn’t work.Use
nuxt devLooking at this, the issue is caused by not using Bridge. (You need to update your nuxt.config.)
You are not alone, I also faced the same problem
@danielroe there is another issue with the same problem and a repo where you can reproduce the problem: https://github.com/nuxt/bridge/issues/314
I am still getting the same issue but while using nuxt bridge. I haven’t tried upgrading to Nuxt 3 yet though.
@danielroe thanks for re-opening and the quick response. I re-applied the changes to upgrade to Nuxt 3 using Bridge and am no longer getting the error. I think we can mark this one down as a user error and re-close. Thanks!