Problem Description
Executing npm run serve after npm install of the front-end project produces the following error message This may cause things to work incorrectly. Make sure to use the same version for both.:
Module build failed: Error:
Vue packages version mismatch:
- [email protected]
- [email protected]
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.
@ ./src/router.js 24:15-48
@ ./src/main.js
@ multi (webpack)-dev-server/client?http://localhost:8080&sockPath=/sockjs-node (webpack)/hot/dev-server ./src/main.js
Cause Analysis:
The above error is mainly because the versions of [email protected] and [email protected] are not unified
solution:
First of all, to use the unified versions of vue and vue-template-compiler, what is needed 注意
is: dependencies in the package.json file. If you want vue version 2.7.8, do not add ^
a symbol in front of the version number (such as: "vue ": "^2.7.8"), otherwise it will automatically find the highest version of the "2.7." series in the library, and the correct specified format should be as follows:
"dependencies": {
...
"vue": "2.7.8"
...
}
Then, you need to delete node_models
the folder and package-lock.json
file, re-npm install
and then npm run serve
the above error will not be reported.