Vue中报错: Uncaught (in promise) Error:Redirected when going from “x“ to “x“ via a navigation guard

项目中遇到如图的错误
Vue中报错: Uncaught (in promise) Error:Redirected when going from “x“ to “x“ via a navigation guard
是因为router的版本问题 和vue/lic有冲突

解决方法:

  1. 删除 node_modules ,到 package.json 中将 vue-router 改为最新稳定版 ,当然vue/cli也要是最新版,重新 npm i (未测试)
  2. // 解决router版本过高 重复点击路由控制台报错问题
    const originalPush = VueRouter.prototype.push
    VueRouter.prototype.push = function push(location) {
    return originalPush.call(this, location).catch(err => err)
    }