vue项目启动后,页面全空白,并报错(install报错)

169 阅读1分钟

背景:

vue项目初步构建好,配置好路由之后启动,页面全空白,控制台报错

app.js:167 Uncaught TypeError: Cannot read properties of undefined (reading 'install')
at Function.Vue.use (vue.runtime.esm.js?c320:5739:1)
at eval (index.js?5aa4:19:1)
at Module../src/router/index.js (app.js:95:1)
at webpack_require (app.js:164:33)
at fn (app.js:420:21)
at eval (main.js:4:65)
at Module../src/main.js (app.js:85:1)
at webpack_require (app.js:164:33)
at app.js:1345:109
at Function.webpack_require.O (app.js:210:23)

image.png

原因

vue-router版本不对,将原本的版本卸载后,重新下载

解决方案

先卸载之前的vue-router:
npm uninstall vue-router

下载指定版本的vue-router
npm i vue-router@3.1.3