vue安裝依賴包時,遇到了一個問題,如下
Vue packages version mismatch:
vue@2.6.12
vue-template-compiler@2.6.10
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.
經過排查發現,package.json中vue的版本配置如下:
"vue": "^2.6.10"
在安裝依賴包時,會自動安裝符合條件的高於或等於2.6.10版本的,所有這里安裝了2.6.12版本
但與vue-template-compiler@2.6.10版本不符合
解決方法有兩個:
方法一:
重新安裝 npm i vue-template-compiler@2.6.12 --save
方法二:
修改package.json中vue的版本配置如下:
去掉‘^’,代表安裝時就會安裝2.6.10版本的vue,不會匹配高版本