报错:vue-template-compiler版本不匹配

在这里插入图片描述

Error:

Vue packages version mismatch:

  • [email protected] (C:\Users\WXY\AppData\Roaming\npm\node_modules\vue\index.js)
  • [email protected] (C:\Users\WXY\AppData\Roaming\npm\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.

解决方法:

  1. 分别执行以下:
    卸载2.x版本 npm uninstall vue-cli -g
    卸载3.x版本 npm uninstall @vue/cli -g
    2.npm install @vue/cli –g
    不指定版本号会默认安装最新的版本

之后便可运行成功
在这里插入图片描述

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐