Skip to content

Vue packages version mismatch: #5161

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
panayotoff opened this issue Feb 8, 2020 · 3 comments · Fixed by #5163
Closed

Vue packages version mismatch: #5161

panayotoff opened this issue Feb 8, 2020 · 3 comments · Fixed by #5163

Comments

@panayotoff
Copy link

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:

  • vue@2.6.10 (/usr/local/lib/node_modules/vue/dist/vue.runtime.common.js)
  • vue-template-compiler@2.6.11 (/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.

@haoqunjiang
Copy link
Member

Please run sudo npm install -g vue.

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

haoqunjiang added a commit to haoqunjiang/vue-cli that referenced this issue Feb 8, 2020
… packages

closes vuejs#5161

The root cause of such issues:

`vue-jscodeshift-adapter` requires `vue-template-compiler`.
`vue-template-compiler` tries to require the `vue` package and check
its version on startup.

Normally, there's no `vue` package in the dependency tree of `@vue/cli`,
so this check will just skip.

But if the user has installed some other global package that depend on
`vue`, and hoists it to the root `node_modules`, `vue-template-compiler`
would successfully require it and check against that `vue` version,
which sometimes may be outdated, thus failing the bootstrap process.
haoqunjiang added a commit that referenced this issue Feb 27, 2020
… packages (#5163)

closes #5161

The root cause of such issues:

`vue-jscodeshift-adapter` requires `vue-template-compiler`.
`vue-template-compiler` tries to require the `vue` package and check
its version on startup.

Normally, there's no `vue` package in the dependency tree of `@vue/cli`,
so this check will just skip.

But if the user has installed some other global package that depend on
`vue`, and hoists it to the root `node_modules`, `vue-template-compiler`
would successfully require it and check against that `vue` version,
which sometimes may be outdated, thus failing the bootstrap process.
@Akryum
Copy link
Member

Akryum commented Apr 17, 2020

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:

- vue@2.6.11 (/home/akryum/.config/yarn/global/node_modules/vue/dist/vue.runtime.common.js)
- vue-template-compiler@2.6.10 (/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)

@Akryum
Copy link
Member

Akryum commented Apr 17, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants