在工作台创建一个vue的项目,vue create 项目名称,出现报错信息:

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.

原因:
可能是之前vue-cli2的版本没清除干净,找到vue.runitme.common.js这个文件删除它(根据报错里提示的路径)
下方中红方框圈起来的便是(报错里提示的路径、不同人的提示路径可能有所不同请留意):
请添加图片描述

并执行下面操作:

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

下方中红方框圈起来的便是(报错中提示的vue的版本号):
请添加图片描述

Logo

基于 Vue 的企业级 UI 组件库和中后台系统解决方案,为数万开发者服务。

更多推荐