vue與vue-template-compiler版本號不一致


報錯信息為:
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.

解決方法:

npm uninstall vue-template-compiler //卸載掉已經安裝的版本
npm i vue-template-compiler@當前版本號 --save //這里的版本號是當前vue的版本號

沒成功。

換一種方法:

npm install
npm update

重復執行了好幾次,還是不行。

最后根據碼工思博博主的思路,發現是之前vue2.0的版本沒清除干凈,找到 vue.runitme.common.js 這個文件刪除它(根據報錯里提示的路徑找本文件,本機路徑為:D:\softwares\node\node_global\node_modules\vue\dist\vue.runtime.common.js)。

成功。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM