如何解决"Vue软件包版本不匹配"的问题, Laravel Spark v4.0.9出现错误? [英] How do I fix a "Vue packages version mismatch" error on Laravel Spark v4.0.9?

查看:454
本文介绍了如何解决"Vue软件包版本不匹配"的问题, Laravel Spark v4.0.9出现错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在Laravel Spark v4.0.9应用程序上运行npm run dev时,出现以下错误:

When I run npm run dev on a Laravel Spark v4.0.9 app, I get the following error:

Module build failed: Error:

Vue packages version mismatch:

- vue@2.0.8
- vue-template-compiler@2.2.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.

我的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"
  }
}

我尝试了以下操作(在不同的时间,不按顺序):

I have tried the following (at different times, not in order):

  • 删除了node_modulesnpm install
  • 尝试仅运行yarnyarn upgrade
  • 删除vue-loader并重新安装
  • 指定vue和vue-template-compiler的确切版本,而不是将其留给npm进行安装或安装以找出依赖关系
  • 删除其他非必需的程序包(vue-router,vue-truncate-filter,vuejs-datepicker),然后再次尝试上述所有程序
  • 把头撞在墙上
  • deleted node_modules and npm install
  • tried just running yarn and yarn upgrade
  • removing vue-loader and reinstalling
  • specifying exact versions of vue and vue-template-compiler rather than leaving it up to npm to install or yarn to figure out dependencies
  • removing other non-essential packages (vue-router, vue-truncate-filter, vuejs-datepicker) and trying all of the above again
  • banging my head against a wall

推荐答案

这对我有用:

  1. 修改package.json:

"vue": "^2.0.8",
"vue-template-compiler": "^2.1.8"

  • 删除node_modules

    这篇关于如何解决"Vue软件包版本不匹配"的问题, Laravel Spark v4.0.9出现错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆