Cannot read property 'parseComponent' of undefined
错误内容
ERROR in ./src/vue/App.vue
Module Error (from ./node_modules/vue-loader/lib/index.js):
Vue packages version mismatch:
- vue@3.0.0 (/Users/stephanie/Desktop/webpack/node_modules/vue/index.js)
- vue-template-compiler@2.6.12 (/Users/stephanie/Desktop/webpack/node_modules/vue-template-compiler/package.json)
This may cause things to work incorrectly. Make sure to use the same version for both.
If you are using vue-loader@>=10.0, simply update vue-template-compiler.
If you are using vue-loader@<10.0 or vueify, re-installing vue-loader/vueify should bump vue-template-compiler to the latest.
@ ./src/main.js 7:0-32 10:7-10
ERROR in ./src/vue/App.vue
Module build failed (from ./node_modules/vue-loader/lib/index.js):
TypeError: Cannot read property 'parseComponent' of undefined
at parse (/Users/stephanie/Desktop/webpack/node_modules/@vue/component-compiler-utils/dist/parse.js:15:23)
at Object.module.exports (/Users/stephanie/Desktop/webpack/node_modules/vue-loader/lib/index.js:67:22)
@ ./src/main.js 7:0-32 10:7-10
webpack 5.1.0 compiled with 2 errors in 4436 ms
package.json
"vue-loader": "^15.9.3",
"vue-template-compiler": "^2.6.12",
"webpack": "^5.1.0",
"vue"":"^3.0.0"
webpack.config.js
const VueLoaderPlugin = require('vue-loader/lib/plugin')
module:{
rules:
{
test: /\.vue$/,
loader: 'vue-loader'
},
},
plugins: [
new VueLoaderPlugin()
],
尝试过的方法
npm update vue-template-compiler ; 把vue-template-compiler升级最新版本,目前最新版本:2.6.12
补充
通过 vue-cli 创建的基于vue3.0 项目是没有问题.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)