Vue 报错解决 Vue packages version mismatch:

621 阅读1分钟

Vue packages version mismatch:

vue@2.6.11 (E:\project2\echarts-demo\node_modules\vue\dist\vue.runtime.common.js)
vue-template-compiler@2.7.14 (E:\project2\echarts-demo\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.

做 demo 的时候 出现了上面这个报错(猜测是 parcel 自动安装依赖的时候弄错了 )

原因

vue 和 vue-template-compiler 版本不相同。这俩的版本一样才是正确的

解决方法

  1. npm uninstall vue-template-compiler
  2. npm install -D vue-template-compiler@和你当前vue一样的把版本号