vue学习笔记 element-plus export ‘createElementVNode‘ (imported as ‘_createElementVNode‘) was not found
·
Vue CLI 版本是5.0.0-beta.3
创建新项目后,运行正常
安装element-plus
运行报错
export ‘createElementVNode’ (imported as ‘_createElementVNode’) was not found in ‘vue’
浏览器中报错误
Uncaught TypeError: (0 , vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode) is not a function
at eval (App.vue?3dfd:2)
at Module../node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[0]!./node_modules/vue-loader/dist/templateLoader.js??ruleSet[1].rules[3]!./node_modules/cache-loader/dist/cjs.js??ruleSet[0].use[0]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[1]!./src/App.vue?vue&type=template&id=7ba5bd90 (app.js:41)
at __webpack_require__ (app.js:287)
at fn (app.js:532)
at Module../src/App.vue?vue&type=template&id=7ba5bd90 (app.js:155)
at __webpack_require__ (app.js:287)
at fn (app.js:532)
at eval (App.vue:2)
at Module../src/App.vue (app.js:74)
at __webpack_require__ (app.js:287)
解决办法是升级vue 到最新版本
"dependencies": {
"core-js": "^3.8.3",
"element-plus": "^1.0.2-beta.70",
"vue": "^3.0.4"
},
npm install vue@3.2.4 --force
记得要用–force 更新,否则错误还会存在
"dependencies": {
"core-js": "^3.8.3",
"element-plus": "^1.0.2-beta.70",
"vue": "^3.2.4"
},
更新过程中,有警告,本人还在学习过程中,暂时不晓得怎么处理。
npm WARN using --force Recommended protections disabled.
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: element-plus@1.0.2-beta.70
npm WARN Found: vue@3.2.4
npm WARN node_modules/vue
npm WARN vue@"3.2.4" from the root project
npm WARN 1 more (@vue/babel-preset-app)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer vue@"3.1.x" from element-plus@1.0.2-beta.70
npm WARN node_modules/element-plus
npm WARN element-plus@"^1.0.2-beta.70" from the root project
npm WARN
npm WARN Conflicting peer dependency: vue@3.1.5
npm WARN node_modules/vue
npm WARN peer vue@"3.1.x" from element-plus@1.0.2-beta.70
npm WARN node_modules/element-plus
npm WARN element-plus@"^1.0.2-beta.70" from the root project
引入ElementPlus
import { createApp } from 'vue'
import App from './App.vue'
import ElementPlus from "element-plus"
import "element-plus/lib/theme-chalk/index.css"
createApp(App).use(ElementPlus).mount('#app')
运行后,错误消失
更多推荐
已为社区贡献5条内容
所有评论(0)