vuepress报错 TypeError: Cannot read properties of undefined (reading ‘tapAsync‘)

背景

vue-cli 3创建一个组件仓库,使用vuepress编写文档上传至github

wepack v5.89.0
vuepress v1.9.x

问题

执行命令 vuepress dev docs 或者 vuepress build docs报错,错误如下

TypeError: Cannot read properties of undefined (reading 'tapAsync')
    at /mnt/datos2/projects/npm-libs/gmap-vue/node_modules/.pnpm/vue-server-renderer@2.6.14/node_modules/vue-server-renderer/server-plugin.js:52:39
    at SyncHook.eval [as call] (eval at create (/mnt/datos2/projects/npm-libs/gmap-vue/node_modules/.pnpm/tapable@1.1.3/node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:11:1)
    at SyncHook.lazyCompileHook (/mnt/datos2/projects/npm-libs/gmap-vue/node_modules/.pnpm/tapable@1.1.3/node_modules/tapable/lib/Hook.js:154:20)
    at Compiler.newCompilation (/mnt/datos2/projects/npm-libs/gmap-vue/node_modules/.pnpm/webpack@4.46.0/node_modules/webpack/lib/Compiler.js:631:26)
    at /mnt/datos2/projects/npm-libs/gmap-vue/node_modules/.pnpm/webpack@4.46.0/node_modules/webpack/lib/Compiler.js:667:29
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/mnt/datos2/projects/npm-libs/gmap-vue/node_modules/.pnpm/tapable@1.1.3/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)
    at AsyncSeriesHook.lazyCompileHook (/mnt/datos2/projects/npm-libs/gmap-vue/node_modules/.pnpm/tapable@1.1.3/node_modules/tapable/lib/Hook.js:154:20)
    at Compiler.compile (/mnt/datos2/projects/npm-libs/gmap-vue/node_modules/.pnpm/webpack@4.46.0/node_modules/webpack/lib/Compiler.js:662:28)
    at /mnt/datos2/projects/npm-libs/gmap-vue/node_modules/.pnpm/webpack@4.46.0/node_modules/webpack/lib/Compiler.js:321:11
    at Compiler.readRecords (/mnt/datos2/projects/npm-libs/gmap-vue/node_modules/.pnpm/webpack@4.46.0/node_modules/webpack/lib/Compiler.js:529:11)
    at /mnt/datos2/projects/npm-libs/gmap-vue/node_modules/.pnpm/webpack@4.46.0/node_modules/webpack/lib/Compiler.js:318:10
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/mnt/datos2/projects/npm-libs/gmap-vue/node_modules/.pnpm/tapable@1.1.3/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)
    at AsyncSeriesHook.lazyCompileHook (/mnt/datos2/projects/npm-libs/gmap-vue/node_modules/.pnpm/tapable@1.1.3/node_modules/tapable/lib/Hook.js:154:20)
    at /mnt/datos2/projects/npm-libs/gmap-vue/node_modules/.pnpm/webpack@4.46.0/node_modules/webpack/lib/Compiler.js:315:19
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/mnt/datos2/projects/npm-libs/gmap-vue/node_modules/.pnpm/tapable@1.1.3/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
    at AsyncSeriesHook.lazyCompileHook (/mnt/datos2/projects/npm-libs/gmap-vue/node_modules/.pnpm/tapable@1.1.3/node_modules/tapable/lib/Hook.js:154:20)
 ELIFECYCLE  Command failed with exit code 1.

解决方案

移除项目内部安装的vuepress,使用全局安装的vuepress

npm i -g vuepress

结语

1、这个报错,未准确定位错误原因,该解决方案,不知道是否适应其他场景,需要尝试

2、问题看上去像是vuepress v1.9.x内部依赖webpack4.x,脚手架生成的项目依赖webpack5.x

3、网上的说法很多都是让降低webpack版本到4.x,但会引出其他问题

  • 6
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值