1987WEB视界-分享互联网热点话题和事件

您现在的位置是:首页 > WEB开发 > 正文

WEB开发

完美解决 Compiled with problems: × ERROR Cannot read properties of undefined (readin

1987web2024-03-26WEB开发33
启动vueui使用npm run serve编译启动时,出现以下问题:

启动vue ui 使用npm  run  serve编译启动时 , 出现以下问题:

Compiled with problems:

x

ERROR

Cannot read properties of undefined (reading use) TypeError: Cannot read properties of undefined (reading use) at eval (webpack-internal:///./src/plugins/element.js:13:45) at ./src/plugins/element.js (http://localhost:8080/js/app.js:96:1) atwebpack_require(http://localhost:8080/js/app.js:337:33) at fn (http://localhost:8080/js/app.js:592:21) at eval (webpack-internal:///./src/main.js:5:77) at ./src/main.js (http://localhost:8080/js/app.js:85:1) atwebpack_require(http://localhost:8080/js/app.js:337:33) at http://localhost:8080/js/app.js:1517:109 atwebpack_require.O (http://localhost:8080/js/app.js:383:23) at http://localhost:8080/js/app.js:1518:53

错误截图如下:

解决方法:

1. 重新创建一个新项目

2. 重新安装依赖. 出现这个问题我是因为我的依赖没有安装好

npm install -g vue 安装全局vue

npm install -g @vue/cli 安装vue脚手架 ,加一个@是最新的版本

3. 修改main.js里面代码   导入包的方式不对

import{createApp}fromvueimportAppfrom./App.vueimportrouter from./router/indexconstapp=createApp(App)app.use(router).mount(#app)

定义一个变量去存,使用变量去调用

声明:本站所有文章,如无特殊说明或标注,均为爬虫抓取以及网友投稿,版权归原作者所有。