errorcannotconnecttoserver翻译中文(解决报错:Uncaught TypeError: Cannot read properties of undefined (reading ‘install‘))
在做vue2项目时出现如下错误 ,页面空白且控制台出现如下错误:
报错内容:
Uncaught TypeError: Cannot read properties of undefined (reading install)
at Vue.use (vue.runtime.esm.js?c320:5709:1)
at eval (index.js?5aa4:7:1)
at ./src/router/index.js (app.js:491:1)
at __webpack_require__ (app.js:584:33)
at fn (app.js:818:21)
at eval (main.js:4:65)
at ./src/main.js (app.js:480:1)
at __webpack_require__ (app.js:584:33)
at app.js:1706:109
at __webpack_require__.O (app.js:630:23)报错图片:
解决办法:
出现该情况的原因是vue-router安装的版本太高 ,一般vue2的项目对应的版本是vue-router@3版本
①在控制台输入: cnpm install --save vue-router@3.5.3 重新安装vue-router即可解决
如果没有安装cnpm命令的 ,可以先安装:cnpm install
②如果安装了cnpm 命令 ,则在控制台输入: cnpm install --save vue-router@3.5.3 重新安装vue-router即可解决
③没有cnpm命令 也可 则在控制台输入: npm install --save vue-router@3.5.3 重新安装vue-router即可解决
创心域SEO版权声明:以上内容作者已申请原创保护,未经允许不得转载,侵权必究!授权事宜、对本内容有异议或投诉,敬请联系网站管理员,我们将尽快回复您,谢谢合作!