Vue router with Vue 3 raises the error "Uncaught TypeError: Object(...) is not a function" Vue router with Vue 3 raises the error "Uncaught TypeError: Object(...) is not a function" vue.js vue.js

Vue router with Vue 3 raises the error "Uncaught TypeError: Object(...) is not a function"


This issue is caused when you install Vue router 3 with Vue 3 so you should uninstall the current version :

npm uninstall vue-router --save

and install the new one by :

npm i vue-router@next --save

Example


For vue3 you should do install the @4 package with the following command:

npm install vue-router@4

Please consult the following migration guide if you're having problems:

https://next.router.vuejs.org/guide/migration/