How do I fix a “Vue packages version mismatch” error on Laravel Spark v4.0.9?

断了今生、忘了曾经 提交于 2019-11-30 06:06:47

This worked for me:

  1. Modify package.json:

    “vue”: “^2.0.8",
    “vue-template-compiler”: “^2.1.8"
    
  2. Delete node_modules

  3. Run npm install

For vue ^2.5.17.

In your package.json

Simply Add this in devDependencies or update the version of vue-template-compiler:

  • "vue-template-compiler": "^2.5.17"

You wil have this output:

"devDependencies": {
  ...
  "lodash": "^4.17.4",
  "popper.js": "^1.14.4",
  "vue": "^2.5.17", // <= note the version
  "vue-template-compiler": "^2.5.17" // <= note the version
},

After that, run:

  • npm install

Npm will update only the updated packages.

Running the following command helped me

npm install vue-template-compiler@2.5.16 --save-dev

NB. Replace the version number with the right version that you need. In my case the version of vue was 2.5.16 and vue-template-compiler was 2.5.13 hence I updated the vue-template-compiler to the version of the vue.

Hope this helps someone

Vue packages version mismatch error fix

Don't need to remove all node_modules folder. Just update packages: vue, vue-template-compiler and vue-server-renderer by @latest flag and it should help for any cases with dismatched versions of vue packages.

npm i vue-template-compiler@latest --save

npm i vue-server-renderer@latest --save

--save will automatically update version in your package.json file. @latest means install latest available version of package. If you need to update vue do it by the same way like we do it in above example.

Also, you always can check new versions for updates by command: npm outdated. It shows you all list of packages, that should be updated.

By the way, npm update command update only minor and patches versions, but it unusles when you want to update major version. For example npm update will not update 2.4.5 => 3.0.1, but can update

Here, vue template compiler compiles the vue template. If you use vue one version and vue-template-compiler another version, that's a problem.

Run this command

npm update vue-template-compiler

This will fix the issue and it will install a vue template compiler same version like vue js version.

Check dependency for vue and replace with exact in dev dependency for vue-template-compiler.

For eg.

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

Should be replaced with:

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

And run the npm install again.

Try this : npm install vue-template-compiler@2.0.8 --save-dev

Converting the vue-template-compiler version to same as vue version (for this case 2.0.8) worked for me. Give it a try.

From the accepted answer, instead of deleting node_modules folder and run again yarn install, you can simply upgrade those 2 packages directly:

yarn upgrade vue@^2.0.8
yarn upgrade vue-template-compiler@^2.1.8

This worked for me:

  1. Modify package.json: "vue": "^2.5.2" to "vue": "2.5.*"
  2. Delete the folder node_modules
  3. Delete package-lock.json
  4. Run npm install

You don't need to delete node_modules folder.

- vue@2.0.8 - vue-template-compiler@2.2.6

Update the package with a lower version number. In this case, npm update vue. Optionally, you may want to npm update vue-loader too

I used npm install vue --save and that worked for me

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!