vue版本冲突解决办法

ERROR in

Vue packages version mismatch:

  • vue@2.1.4
  • vue-template-compiler@2.1.5

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.

@ ./main.js 15:11-27

卧槽,简直了,只要我import app.vue 就报错,无论我app.vue有木有写东西,都报错,我也是醉了

回来发现,原来是我的package.json里面忘记依赖了vue-loader,好吧,我赶紧依赖了一下,结果又报错,说我vue-loader和vue-template-complier版本不一致

我赶紧把版本改成一致的,然后,npm install,结果还是这么报错。

最后上了大招,直接在node-modules文件夹下面把不一致的vue-loader和vue-template-complier文件夹干掉之后,再重新npm install 终于ok了!!!

{
  "name": "vue-demo",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo "Error: no test specified" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "babel": "^6.5.2",
    "babel-core": "^6.18.2",
    "babel-loader": "^6.2.8",
    "babel-preset-es2015": "^6.18.0",
    "css-loader": "^0.26.0",
    "extract-text-webpack-plugin": "^1.0.1",
    "less": "^2.7.1",
    "less-loader": "^2.2.3",
    "style-loader": "^0.13.1",
    "vue": "2.1.4",
    "vue-loader": "10.0.0",
    "vue-router": "latest",
    "vue-template-compiler": "2.1.4",
    "webpack": "^1.13.3"
  },
  "dependencies": {
    "webpack": "^1.13.3"
  }
}


原文地址:https://www.cnblogs.com/ae6623/p/6175716.html