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.

After upgrading to RC.11, useRouter() cannot be used in composable

See original GitHub issue

Environment

  • Operating System: Windows_NT
  • Node Version: v16.17.1
  • Nuxt Version: 3.0.0-rc.11
  • Nitro Version: 0.5.4
  • Package Manager: yarn@1.22.19
  • Builder: vite
  • User Config: ssr, head, css, plugins, components, buildModules, modules, build, vite, serverHandlers, devServerHandlers, bridge
  • Runtime Modules: -
  • Build Modules: (), @nuxt/bridge@3.0.0-27740081.058a6c1

Reproduction

nuxt-bridge-rc11.zip

Describe the bug

I used the command npx nuxi@latest upgrade --force from https://github.com/nuxt/framework/discussions/7691 and when trying to use useRouter I get the following error:

[vue-router]: Missing current instance. useRouter() must be called inside <script setup> or setup().

useRouetr is used only after clicking on the button, when the instance is ready. Everything works fine in RC.8

Additional context

How can I safely roll back to RC.8?

Logs

No response

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
BrandonlinUcommented, Oct 3, 2022

Possible duplicate of #554?

2reactions
MartinX3commented, Oct 2, 2022

Has it something to do with the vue-router 3.6 release adding useRoute() and useRouter() as composables for vue 2.7?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Router in axum::routing - Rust - Docs.rs
use axum::{routing::get, Router}; let app = Router::new() .route("/", ... method will run after routing and thus cannot be used to rewrite the request...
Read more >
Using Modules and Pinia to structure Nuxt 3 app
Modules are used to extend Nuxt core functionality. These modules can contain their own components, composables, pages, plugins, and even a ...
Read more >
useRouter/withRouter receive undefined on query in first render
I found something: isReady: boolean - Whether the router fields are updated client-side and ready for use. Should only be used inside of ......
Read more >
Router tutorial: tour of heroes - Angular
forRoot(); Set the router to compose HTML5 browser URLs ... When you use the Angular CLI to create a project that does use...
Read more >
'useRouter' is not defined no-undef Code Example
isLoggedIn = function() {return false}) react redux . What is the use of the return function in the React Native Framework?
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