[Solved] Vue3 Error: export ‘createRouter‘ was not found in ‘vue-router‘

I started learning vue3 recently, because I have been using vue2. X before. When I write vue3, I will find that there are some differences between the two. Then I will have a variety of problems during practice. I summarize and share it with you here.

1.Error reporting

“export ‘createRouter’ was not found in ‘vue-router’
“export ‘createWebHashHistory’ was not found in ‘vue-router’

2. Error reporting causes and Solutions

If you read my last article, you should be able to see the reason for the error at a glance. This error occurs because we use the wrong Vue router package. We have installed version 2. X. because we are developing and using vue3, we also need to install the Vue router package of vue3. We only need to uninstall the previously installed Vue router package, and then reinstall the Vue router package of vue3.

// uninstall vue2.x vue-router
npm uninstall vue-router --save
// install vue3 vue-router
npm install vue-router@next --save

This can be solved. I hope it will help you!

Read More: