Vue-cli: Vue packages version mismatch:

Created on 8 Feb 2020  路  3Comments  路  Source: vuejs/vue-cli

Version

4.2.2

Environment info

Environment Info:

  System:
    OS: macOS 10.15.3
    CPU: (4) x64 Intel(R) Core(TM) i5-7360U CPU @ 2.30GHz
  Binaries:
    Node: 10.17.0 - /usr/local/bin/node
    Yarn: 1.21.1 - ~/.yarn/bin/yarn
    npm: 6.13.6 - /usr/local/bin/npm
  Browsers:
    Chrome: 80.0.3987.87
    Firefox: 72.0.1
    Safari: 13.0.5
  npmGlobalPackages:
    @vue/cli: 4.2.2

Steps to reproduce

Install @vue/cli using `sudo npm install -g @vue/cli Try to create new project with vue create myproject

What is expected?

Scaffold new Vue project

What is actually happening?

Throws new error

Error:

Vue packages version mismatch:

  • [email protected] (/usr/local/lib/node_modules/vue/dist/vue.runtime.common.js)
  • [email protected] (/usr/local/lib/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.

enhancement has PR

Most helpful comment

Workaround:

akryum@akryum-XPS-13-9370:~$ cd .config/yarn/global/
akryum@akryum-XPS-13-9370:~/.config/yarn/global$ rm -rf node_modules/
akryum@akryum-XPS-13-9370:~/.config/yarn/global$ rm yarn.lock 
akryum@akryum-XPS-13-9370:~/.config/yarn/global$ yarn

All 3 comments

Please run sudo npm install -g vue.

Seems due to wrong hoisting or because you 've previously installed an old version of vue globally.

Seems to not be fixed. (Installed with yarn global add @vue/cli)

$ vue create test-e2e
/home/akryum/.config/yarn/global/node_modules/vue-template-compiler/index.js:10
  throw new Error(
  ^

Error: 

Vue packages version mismatch:

- [email protected] (/home/akryum/.config/yarn/global/node_modules/vue/dist/vue.runtime.common.js)
- [email protected] (/home/akryum/.config/yarn/global/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.

    at Object.<anonymous> (/home/akryum/.config/yarn/global/node_modules/vue-template-compiler/index.js:10:9)
    at Module._compile (internal/modules/cjs/loader.js:956:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)
    at Module.load (internal/modules/cjs/loader.js:812:32)
    at Function.Module._load (internal/modules/cjs/loader.js:724:14)
    at Module.require (internal/modules/cjs/loader.js:849:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (/home/akryum/.config/yarn/global/node_modules/vue-jscodeshift-adapter/src/parse-sfc.js:1:18)
    at Module._compile (internal/modules/cjs/loader.js:956:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)

Workaround:

akryum@akryum-XPS-13-9370:~$ cd .config/yarn/global/
akryum@akryum-XPS-13-9370:~/.config/yarn/global$ rm -rf node_modules/
akryum@akryum-XPS-13-9370:~/.config/yarn/global$ rm yarn.lock 
akryum@akryum-XPS-13-9370:~/.config/yarn/global$ yarn

Was this page helpful?
0 / 5 - 0 ratings