2017-04-13 67 views
1

當我在Laravel星火v4.0.9應用程序運行npm run dev,我得到以下錯誤:如何在Laravel Spark v4.0.9上修復「Vue軟件包版本不匹配」錯誤?

Module build failed: Error: 

Vue packages version mismatch: 

- [email protected] 
- [email protected] 

This may cause things to work incorrectly. Make sure to use the same version for both. 
If you are using [email protected]>=10.0, simply update vue-template-compiler. 
If you are using [email protected]<10.0 or vueify, re-installing vue-loader/vueify should bump vue-template-compiler to the latest. 

package.json看起來是這樣的:

{ 
    "private": true, 
    "scripts": { 
    "dev": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js", 
    "watch": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js", 
    "hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js", 
    "production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js" 
    }, 
    "dependencies": { 
    "axios": "^0.15.2", 
    "bootstrap": "^3.0.0", 
    "cross-env": "^3.2.3", 
    "jquery": "^2.1.4", 
    "js-cookie": "^2.1.0", 
    "laravel-mix": "0.*", 
    "moment": "^2.10.6", 
    "promise": "^7.1.1", 
    "sweetalert": "^1.1.3", 
    "underscore": "^1.8.3", 
    "urijs": "^1.17.0", 
    "vue": "~2.0.1", 
    "vue-resource": "^1.2.0", 
    "vue-router": "^2.2.1", 
    "vue-truncate-filter": "^1.1.6", 
    "vuejs-datepicker": "^0.6.2" 
    }, 
    "devDependencies": { 
    "browser-sync": "^2.18.8", 
    "browser-sync-webpack-plugin": "^1.1.4" 
    } 
} 

我曾嘗試以下(在不同的時間不按順序):

  • 刪除node_modulesnpm install
  • 試圖只是運行yarnyarn upgrade
  • 刪除vue-loader並重新安裝
  • 指定VUE和VUE模板編譯的確切版本,而不是留給了NPM安裝或紗線找出依賴
  • 其他非移除-essential包(VUE路由器,VUE截形過濾器,vuejs,日期選擇器)和嘗試所有敲我的頭靠在牆上
+0

'紗升級vue'達2.4.1爲我解決了這個問題 –

回答

1

這爲我工作上面再

  • 的:

    1. 修改package.json

      「vue」: 「^2.0.8", 
      「vue-template-compiler」: 「^2.1.8" 
      
    2. 刪除node_modules

    3. 運行npm install
  • +0

    像老闆一樣!是的,這對我也有效。謝謝@Espen。 –

    0

    檢查依賴於vue與準確替換開發依賴於vue-template-compiler

    例如,

    "dependencies": { 
        "vue": "^2.5.2", 
    }, 
    "devDependencies": { 
        "vue-template-compiler": "^2.5.3", 
    }, 
    

    應改爲:

    "dependencies": { 
        "vue": "2.5.2", 
    }, 
    "devDependencies": { 
        "vue-template-compiler": "2.5.2", 
    }, 
    

    ,並再次運行npm install

    0

    這爲我工作:

    1. 修改的package.json: 「VUE」: 「^ 2.5.2」 到 「VUE」: 「2.5 *」
    2. 刪除文件夾node_modules
    3. 運行npm install
    0

    在這裏,vue模板編譯器編譯vue模板。如果你使用vue one版本和vue-template-compiler另一個版本,這是一個問題。

    運行此命令

    npm update vue-template-compiler 
    

    這將解決這個問題,它會安裝一個VUE模板編譯器版本相同像VUE js版。

    相關問題