Vue packages version conflicts 錯誤修復

scorpiozj發表於2018-11-25

我們在使用Vue作為weex中的前端框架的開發過程中,某次 npm start 遇到了如下的錯誤:

Vue packages version mismatch: - vue@2.5.16 - vue-template-compiler@2.5.13 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-loader 的版本,然後更新 vue-template-compiler:

npm install vue-template-compiler@2.5.16 -g

但是,再次start後仍然遇到相同的錯誤。搜尋後,有人提示重新安裝weex toolkit等方法。很遺憾,嘗試過重灌後還是有該問題。
稍一思索,猜測應該是weex中使用到的module版本和全域性安裝的module不是同一個。於是,檢查安裝的weex module,在weex-toolkit下的 node_modules 中發現了weex-builder。然後繼續在該資料夾下的 node_modules中找到 vue-template-compiler,發現其版本確實是 2.5.13。相應的解決方法是把全域性安裝的 vue-template-compiler module複製到 weex-builder下。 最終,問題解決。
雖然weex已經開源了相當一段時間,但社群不夠活躍。這一點,可以從遇到問題搜尋出來的有效內容數量不多看出。因此,遇到問題的時候,需要具備分析問題產生根本原因的能力。同時,也要多分享,希望可以遇到更多志同道合的人。

 

本文已同步至:Vue packages version conflicts 錯誤修復, 歡迎訪問。

 

相關文章