vue项目,package.json中Vue和vue-template-compiler版本不一致时,执行npm run dev有时会报错

提示如下内容

 in ./src/views/login/index.vue

Module build failed: Error:

Vue packages version mismatch:

- vue@2.5.10 (E:\美好家\beauty_web\move\node_modules\vue\dist\vue.runtime.common.js)
- vue-template-compiler@2.6.10 (E:\美好家\beauty_web\move\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.

解决方法 :

第一步:执行npm uninstall vue-template-compiler
第二步:执行npm install vue-template-compiler@报错中提示的vue的版本号

报错中提示的vue的版本号 一般指的使在这里插入图片描述
所以以本次错误测试案例执行的方法为如下内容

第一步:执行npm uninstall vue-template-compiler
第二步:执行npm install vue-template-compiler@2.5.10

如果帮助到了你请帮忙点个赞

Logo

前往低代码交流专区

更多推荐