Vue: Vue 2.0.3 packages version mismatch

Created on 14 Oct 2016  Â·  26Comments  Â·  Source: vuejs/vue

Vue.js version

2.0.3

Reproduction Link

My app
CI log

The app's console says that Uncaught Error: Cannot find module "../components/List.vue"(…)

When i use CI to build my app, the bug happens, and the CI log shows that

Vue packages version mismatch:
- [email protected]
- [email protected]

FYI,i used vue-cli and webpack template to create my app.
And i have reinstalled the vue-loader.
The weird thing is that when i use npm run dev, it works well.

Most helpful comment

npm update vue

Fixed it for me

All 26 comments

Re-install vue-loader.

Re-install vue-loader still can't work.
I switched to [email protected] and it works now.

Are you using yarn with lock? This is likely either your npm registry not being up to date or you're not explicitly upgrading vue-loader.

npm update vue

Fixed it for me

I was following the official "getting started" guide and I couldn't even get a hello world up until I saw the previous comment. I was following the "CLI method" here: https://vuejs.org/v2/guide/installation.html

Same issue for me I've just upgraded a project that have been generated by vue-cli few months ago.
The problem is maybe because it is declared as peerDependencies in vue-loader?
https://github.com/vuejs/vue-loader/blob/master/package.json#L47

My solution (may be not the right one) is to add the library manually as devDependencies in the generated project

"devDependencies": {

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

}

I've removed my node_modules folder and executed npm install .

In my case, I am using laravel mix and like @gdomiciano, I've removed the node_modules and run npm install

Just re-install the vue-loader for the latest release.

$ npm uninstall vue-loader
$ npm install [email protected]

I was using Laravel Mix which has a dependency on an older vue-template-compiler, and somehow the lock file wasn't consistent. I updated Laravel Mix and the lock file fixed itself, and the error disappeared.

If you're not using Laravel Mix, look for vue-template-compiler under another dependency and try to reinstall it or update it.

npm update vue-template-compiler solved my problem, or you can try to re-install it

npm uninstall vue-template-compiler
npm install vue-template-compiler
worked for me

I did what @gdomiciano suggested, but probably @warren32 's would also work and much faster.

vue-template-compiler and vue should be the same version (for me)

vue-template-compiler and vue should be same, true..
Should't npm install vue-template-compiler do a check on available vue js version.
And install the correct same version !

Work around
npm uninstall vue-template-compiler
npm install "vue-template-compiler@$(npm list --depth=0 | awk '/vue@/{print substr($2, 5)}')"

_OR simply as a single command._
npm uninstall vue-template-compiler & npm install "vue-template-compiler@$(npm list --depth=0 | awk '/vue@/{print substr($2, 5)}')"

Explanation:

  1. Uninstall the existing verion of vue-template-compiler
    npm uninstall vue-template-compiler
  2. Find the version number of installed vue js ([email protected]_), [substr with 5 to get version number]
    npm list --depth=0 | awk '/vue@/{print substr($2, 5)}
  3. Create string for vue-template-compiler package with matching vue js verion ([email protected]_)
    vue-template-compiler@$(npm list --depth=0 | awk '/vue@/{print substr($2, 5)}')
  4. Install the correct vue-template-compiler package(_npm install [email protected]_)
    npm install "vue-template-compiler@$(npm list --depth=0 | awk '/vue@/{print substr($2, 5)}')"

yarn installation has a problem, although I specified the _exact version_, yarn seems to install latest version of vue-template-compiler for me!
I cleared yarn's cache and removed the node_modules folder, but no luck.

After all that, npm install got the job done!

Lots of great comments here. If you have a few minutes, or just want everything to work, do this (worked for me at least):

  1. Remove node_modules folder
  2. Delete package-lock.json
  3. Delete yarn.lock
  4. Run yarn
  5. Profit

npm uninstall vue-template-compiler and npm install vue-template-compiler worked for me.

Please make vue-template-compiler and vue to be the same version. As what @wagnlinzh say.

npm uninstall vue-template-compiler
npm install vue-template-compiler
worked for me

Hi friends - just FYI: this issue could also happen if you're using a mirror of npm. (eg. when the mirror has an updated version of one package and not of the other). The solution then (IMO, of course) would be to either update the mirror or lock both versions.

In my case the problem was a version mismatch with vue and vue-template-compiler. Fixed by upgrading both packages, so now they both have the same version.

# one may not need -g, in my case I was installing vue/cli globally.
npm install -g vue
npm install -g vue-template-compiler

In my case the problem was a version mismatch with vue and vue-template-compiler. Fixed by upgrading both packages, so now they both have the same version.

# one may not need -g, in my case I was installing vue/cli globally.
npm install -g vue
npm install -g vue-template-compiler

Faceing issue for Vue and Vue-template-compiler mismatch
THIS SOLUTION SOLVED MY PROBLEM

In my case the problem was a version mismatch with vue and vue-template-compiler. Fixed by upgrading both packages, so now they both have the same version.

# one may not need -g, in my case I was installing vue/cli globally.
npm install -g vue
npm install -g vue-template-compiler

It work for me
Thank you

I navigated to the /vuedirectory and the /dist directory. This worked for me.

/usr/local/lib/node_modules/vue/dist

In my case the problem was a version mismatch with vue and vue-template-compiler. Fixed by upgrading both packages, so now they both have the same version.

# one may not need -g, in my case I was installing vue/cli globally.
npm install -g vue
npm install -g vue-template-compiler

works like charm.....thanks champ

Was this page helpful?
0 / 5 - 0 ratings