报错 - If you are using vue-loader@>=10.0, simply update vue-template-compiler...

  Yesterday, after pulling the code down and installing dependencies successfully, I compiled and started the project, but an error was reported, and I 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.found out that the version of vue is different from the version of vue-template-compiler. Vue is [email protected]the version, and vue-template-compiler is [email protected]the version.

1. Error reporting

insert image description here

Vue packages version mismatch:

- [email protected] (E:\项目xxx-mobile\node_modules\vue\dist\vue.runtime.common.js)
- [email protected] (E:\项目\xxx-mobile\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> (E:\项目\xxx-mobile\node_modules\vue-template-compiler\index.js:10:9)    
    at Module._compile (node:internal/modules/cjs/loader:1103:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1155:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at loadFromContext (E:\项目\xxx-mobile\node_modules\vue-loader\lib\compiler.js:30:10)
    at loadTemplateCompiler (E:\项目\xxx-mobile\node_modules\vue-loader\lib\compiler.js:37:12)
    at exports.resolveCompiler (E:\项目\xxx-mobile\node_modules\vue-loader\lib\compiler.js:25:23)
    at VueLoaderPlugin.apply (E:\项目\xxx-mobile\node_modules\vue-loader\lib\plugin-webpack5.js:144:22)
    at createCompiler (E:\项目\xxx-mobile\node_modules\webpack\lib\webpack.js:73:12)
    at create (E:\项目\xxx-mobile\node_modules\webpack\lib\webpack.js:134:16)
    at webpack (E:\项目\xxx-mobile\node_modules\webpack\lib\webpack.js:158:32)
    at WebpackCLI.f [as webpack] (E:\项目\xxx-mobile\node_modules\webpack\lib\index.js:64:16)
    at WebpackCLI.createCompiler (E:\项目\xxx-mobile\node_modules\webpack-cli\lib\webpack-cli.js:1789:29)
error Command failed with exit code 2.

Two, the solution

  Change the version of vue to the version of vue-template-compiler to be consistent

	npm i [email protected] --save

It is recommended to delete the original vue-template-compiler first, and then re-install

Guess you like

Origin blog.csdn.net/LiaoFengJi/article/details/129044371