运行Serve报错Vue和vue-template-compiler版本不一致问题

本文介绍了如何在Vue项目中处理package.json中Vue与vue-template-compiler版本不一致的问题,步骤包括卸载旧版本并重新安装指定版本。

在vue项目运行时终端报错package.json中Vue和vue-template-compiler版本不一致,提示vue和vue-template-compiler版本不匹配的问题,解决办法:

先执行npm uninstall vue-template-compiler;然后再执行npm install vue-template-compiler@报错中提示的vue的版本号;
安装完后再次运行即可。

> jbs@2.0.0 dev > vue-cli-service serve INFO Starting development server... ERROR Error: Vue packages version mismatch: - vue@2.6.12 (D:\pc\guoneng\pc\node_modules\vue\dist\vue.runtime.common.js) - vue-template-compiler@2.6.10 (D:\pc\guoneng\pc\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. Error: Vue packages version mismatch: - vue@2.6.12 (D:\pc\guoneng\pc\node_modules\vue\dist\vue.runtime.common.js) - vue-template-compiler@2.6.10 (D:\pc\guoneng\pc\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. at Object.<anonymous> (D:\pc\guoneng\pc\node_modules\vue-template-compiler\index.js:10:9) at Module._compile (node:internal/modules/cjs/loader:1356:14) at Module._extensions..js (node:internal/modules/cjs/loader:1414:10) at Module.load (node:internal/modules/cjs/loader:1197:32) at Module._load (node:internal/modules/cjs/loader:1013:12) at Module.require (node:internal/modules/cjs/loader:1225:19) at require (node:internal/modules/helpers:177:18) at loadFromContext (D:\pc\guoneng\pc\node_modules\vue-loader\lib\compiler.js:30:10) at loadTemplateCompiler (D:\pc\guoneng\pc\node_modules\vue-loader\lib\compiler.js:37:12) at exports.resolveCompiler (D:\pc\guoneng\pc\node_modules\vue-loader\lib\compiler.js:25:23) at VueLoaderPlugin.apply (D:\pc\guoneng\pc\node_modules\vue-loader\lib\plugin-webpack4.js:91:22) at VueLoaderPlugin.apply (D:\pc\guoneng\pc\node_modules\vue-loader\lib\plugin.js:13:16) at webpack (D:\pc\guoneng\pc\node_modules\@vue\cli-service\node_modules\webpack\lib\webpack.js:47:13) at serve (D:\pc\guoneng\pc\node_modules\@vue\cli-service\lib\commands\serve.js:134:22) at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
最新发布
11-21
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值