一、报错信息
通过 npm install element-plus@2.4.3 --save
命令安装好element-plus后,准备快速开始使用它的Button组件,但是配置完成后npm run serve
出现下面的报错。
App running at:
ERROR Failed to compile with 1 error 11:05:29
error in ./src/Buttton.vue?vue&type=template&id=574daa77&ts=true
Module parse failed: Unexpected token (7:27)
File was processed with these loaders:
* ./node_modules/vue-loader/dist/templateLoader.js
* ./node_modules/vue-loader/dist/index.js
You may need an additional loader to handle the result of these loaders.
| const _hoisted_3 = { class: "mb-4" }
|
> export function render(_ctx: any,_cache: any,$props: any,$setup: any,$data: any,$options: any) {
| const _component_el_button = _resolveComponent("el-button")!
|
ERROR in ./src/Buttton.vue?vue&type=template&id=574daa77&ts=true (./node_modules/vue-loader/dist/templateLoader.js??ruleSet[1].rules[3]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./src/Buttton.vue?vue&type=template&id=574daa77&ts=true) 7:27
Module parse failed: Unexpected token (7:27)
File was processed with these loaders:
* ./node_modules/vue-loader/dist/templateLoader.js
* ./node_modules/vue-loader/dist/index.js
You may need an additional loader to handle the result of these loaders.
| const _hoisted_3 = { class: "mb-4" }
二、解决方案
找到引入的Button.vue中script方法标签的lang
属性,直接删除。
然后就会编译成功了。
我强烈推荐4本可以改变命运的经典著作: