vue: Vue 2.0.3 packages version mismatch

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:
- vue@2.0.3
- vue-template-compiler@2.0.2

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.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 26 (2 by maintainers)

Most upvoted comments

npm update vue

Fixed it for me

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

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

$ npm uninstall vue-loader
$ npm install vue-loader@11.0.0

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

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 (vue@2.3.4), [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 (vue-template-compiler@2.3.4) vue-template-compiler@$(npm list --depth=0 | awk ‘/vue@/{print substr($2, 5)}’)
  4. Install the correct vue-template-compiler package(npm install ue-template-compiler@2.3.4) npm install "vue-template-compiler@$(npm list --depth=0 | awk '/vue@/{print substr($2, 5)}')"

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",

}

Re-install vue-loader.

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

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

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

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

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

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

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

Re-install vue-loader still can’t work. I switched to vue@2.0.2 and it works now.