首页 > 其他分享 >vuepress 运行报错 Vue packages version mismatch:

vuepress 运行报错 Vue packages version mismatch:

时间:2022-10-13 10:22:21浏览次数:54  
标签:node Vue modules mismatch loader internal 报错 vuepress cjs

vuepress 运行报错 Vue packages version mismatch:

D:\vuepress-test>npm run docs:dev
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.

> [email protected] docs:dev
> vuepress dev docs

D:\vuepress-test\node_modules\vue-server-renderer\index.js:8
  throw new Error(
  ^

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.

    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

image-20221013101628646

就可以正常编译运行了

image-20221013101701405

标签:node,Vue,modules,mismatch,loader,internal,报错,vuepress,cjs
From: https://www.cnblogs.com/STRSong/p/16787233.html

相关文章