vue: Vue 2.0.3 packages version mismatch
Vue.js version
2.0.3
Reproduction Link
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)
npm update vueFixed it for me
npm uninstall vue-template-compilernpm install vue-template-compilerworked for meJust re-install the
vue-loaderfor the latest release.I’ve removed my node_modules folder and executed
npm install.vue-template-compilerandvueshould be the same version (for me)vue-template-compiler and vue should be same, true… Should’t
npm install vue-template-compilerdo a check on available vue js version. And install the correct same version !Work around
npm uninstall vue-template-compilernpm 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:
npm uninstall vue-template-compilernpm list --depth=0 | awk '/vue@/{print substr($2, 5)}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
Re-install vue-loader.
In my case the problem was a version mismatch with
vueandvue-template-compiler. Fixed by upgrading both packages, so now they both have the same version.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-compilerunder another dependency and try to reinstall it or update it.npm update vue-template-compilersolved my problem, or you can try to re-install itLots of great comments here. If you have a few minutes, or just want everything to work, do this (worked for me at least):
node_modulesfolderpackage-lock.jsonyarn.lockyarnI navigated to the
/vuedirectory and the/distdirectory. This worked for me./usr/local/lib/node_modules/vue/distI 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 installRe-install
vue-loaderstill can’t work. I switched tovue@2.0.2and it works now.