You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Vue PWA报错TypeError: Cannot read properties of undefined (reading 'tap')求解决方案

解决Vue添加PWA后出现TypeError: Cannot read properties of undefined (reading 'tap')的问题

修复命令与步骤

  • 清理缓存并重装依赖
    npm cache clean --force
    rm -rf node_modules package-lock.json
    npm install
    
  • 降级vue-cli-plugin-pwa版本(适配版本不兼容场景)
    先卸载现有插件:
    npm uninstall vue-cli-plugin-pwa
    
    安装兼容版本(以适配Vue 2的4.5.19版本为例):
    npm install vue-cli-plugin-pwa@4.5.19 --save-dev
    
  • 更新Vue CLI至最新版本
    npm update @vue/cli -g
    
  • 重新生成PWA配置
    vue invoke pwa
    

补充说明

该错误多因vue-cli-plugin-pwa或依赖的workbox-webpack-plugin与当前Vue CLI版本不兼容导致。若上述命令无效,可尝试删除vue.config.js中的PWA相关配置后,重新执行vue invoke pwa生成默认配置。

内容的提问来源于stack exchange,提问作者fine man

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.24 20:46:04