vuepress 运行报错 Vue packages version mismatch:
vuepress 运行报错 Vue packages version mismatch:
D:\vuepress-test>npm run docs:dev
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
> vuepress-test@1.0.0 docs:dev
> vuepress dev docs
D:\vuepress-test\node_modules\vue-server-renderer\index.js:8
throw new Error(
^
Error:
Vue packages version mismatch:
- vue@2.7.12
- vue-server-renderer@2.7.11
This may cause things to work incorrectly. Make sure to use the same version for both.
at Object.<anonymous> (D:\vuepress-test\node_modules\vue-server-renderer\index.js:8:9)
at Module._compile (node:internal/modules/cjs/loader:1105:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159: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 Object.<anonymous> (D:\vuepress-test\node_modules\@vuepress\core\lib\node\build\index.js:11:34)
at Module._compile (node:internal/modules/cjs/loader:1105:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159: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 Object.<anonymous> (D:\vuepress-test\node_modules\@vuepress\core\lib\node\App.js:21:22)
at Module._compile (node:internal/modules/cjs/loader:1105:14)
这是vue和vue-template-compiler版本不一致导致的
本机的版本是2.7.12,vue-server-renderer的是2.7.11
可以找到
node_modules\vue-server-renderer
目录下的package.json,把vue-server-renderer
编译时的vue版本指定为2.7.12
就可以正常编译运行了