错误内容
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 项目是没有问题. 😁
同样问题链接
Cannot read Property ‘parseComponent’ of undefined
`