Vue packages version mismatch解决方案

在工作台创建一个vue/cli3的项目,vue create 项目名称,报错信息如下:

ERROR Error:

Vue packages version mismatch:

vue@2.6.10 (D:softwares
ode
ode_global
ode_modulesvuedistvue.runtime.common.js)
vue-template-compiler@2.6.11 (D:softwares
ode
ode_global
ode_modules@vuecli
ode_modulesvue-template-compilerpackage.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 i vue-template-compiler@当前版本号 --save //这里的版本号是当前vue的版本号
没成功~~~

方法二:
npm install
npm update
还是没成功~~~

最后发现是之前vue-cli2的版本没清除干净,找到vue.runitme.common.js这个文件删除它(根据报错里提示的路径)
成功!!!

原文地址:https://www.cnblogs.com/shemingxin/p/12466633.html