目录

  • 出错现象
  • 出错原因
  • 解决方案

出错现象

这个报错是我在用webpack+vue-loader的时候报的错误

  • 报错信息
ERROR in ./src/App.vue
Module Error (from ./node_modules/vue-loader/lib/index.js):
[vue-loader] vue-template-compiler must be installed as a peer dependency, or a compatible compiler implementation must be passed via options.
 @ ./src/main.js 2:0-27 9:17-20

ERROR in ./src/App.vue
Module build failed (from ./node_modules/vue-loader/lib/index.js):
TypeError: Cannot read property 'parseComponent' of undefined
    at parse (E:\professer\lagou\lagou-homework\fed-e-task-02-02\code\vue-app-base\node_modules\@vue\component-compiler-utils\dist\parse.js:15:23)
    at Object.module.exports (E:\professer\lagou\lagou-homework\fed-e-task-02-02\code\vue-app-base\node_modules\vue-loader\lib\index.js:67:22)
 @ ./src/main.js 2:0-27 9:17-20

homework-error1.png

出错原因

因为项目vue中的template需要解析,他提示我们安装依赖模块vue-template-compiler

解决方案

安装依赖模块npm i vue-template-compiler --save-dev即可

it works~

Logo

前往低代码交流专区

更多推荐