NPM run dev 遇到的報錯!vue 和 vue-template-compiler 版本不一致

王鯨弋發表於2019-02-17
  1. npm run dev 時報錯:
    ERROR in ./resources/assets/js/components/steps.vue
    Module Error (from ./node_modules/vue-loader/lib/index.js):
    Vue packages version mismatch:
    - vue@2.6.5
    - vue-template-compiler@2.6.6
    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.
    @ ./resources/assets/js/app.js 12:13-46
    @ multi ./resources/assets/js/app.js ./resources/assets/sass/app.scss
    ERROR in ./resources/assets/js/components/steps.vue
    Module build failed (from ./node_modules/vue-loader/lib/index.js):
    TypeError: Cannot read property 'parseComponent' of undefined
    at parse (/home/vagrant/Code/Taskmanager/node_modules/@vue/component-compiler-utils/dist/parse.js:14:23)
    at Object.module.exports (/home/vagrant/Code/Taskmanager/node_modules/vue-loader/lib/index.js:67:22)
    @ ./resources/assets/js/app.js 12:13-46
    @ multi ./resources/assets/js/app.js ./resources/assets/sass/app.scss

package.json 檔案中同一一下版本:

 "dependencies": {
        "vue": "2.5.21",
        "vue-template-compiler": "2.5.21"
    }

npm install npm update 就解決了。

本作品採用《CC 協議》,轉載必須註明作者和本文連結
相信時間和變化

相關文章