报错信息为:
ERROR Error:
Vue packages version mismatch:
- vue@2.6.10 (D:\softwares\node\node_global\node_modules\vue\dist\vue.runtime.common.js)
- vue-template-compiler@2.6.11 (D:\softwares\node\node_global\node_modules@vue\cli\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 i vue-template-compiler@当前版本号 --save //这里的版本号是当前vue的版本号
没成功。
换一种方法:
npm install
npm update
重复执行了好几次,还是不行。
最后根据码工思博博主的思路,发现是之前vue2.0的版本没清除干净,找到 vue.runitme.common.js 这个文件删除它(根据报错里提示的路径找本文件,本机路径为:D:\softwares\node\node_global\node_modules\vue\dist\vue.runtime.common.js)。
成功。