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版本(适配版本不兼容场景)
先卸载现有插件:
安装兼容版本(以适配Vue 2的4.5.19版本为例):npm uninstall vue-cli-plugin-pwanpm 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
相关产品推荐
相关产品推荐

