错误提示信息如下:
App threw an error during load

Error: Cannot find module 'fs/promises'
    at webpackMissingModule (/home/syx/code/desktop/dist/main.js:14205:84)
    at Object../node_modules/_electron-updater@4.6.5@electron-updater/out/AppUpdater.js (/home/syx/code/desktop/dist/main.js:14205:170)
    at __webpack_require__ (/home/syx/code/desktop/dist/main.js:20:30)
    at Object../node_modules/_electron-updater@4.6.5@electron-updater/out/main.js (/home/syx/code/desktop/dist/main.js:16516:20)
    at __webpack_require__ (/home/syx/code/desktop/dist/main.js:20:30)
    at Object../src/splashscreen.ts (/home/syx/code/desktop/dist/main.js:71674:19)
    at __webpack_require__ (/home/syx/code/desktop/dist/main.js:20:30)
    at Object../src/winsmanager.ts (/home/syx/code/desktop/dist/main.js:71957:22)
    at __webpack_require__ (/home/syx/code/desktop/dist/main.js:20:30)
    at Object../src/main.ts (/home/syx/code/desktop/dist/main.js:70800:21)
A JavaScript error occurred in the main process
Uncaught Exception:
Error: Cannot find module 'fs/promises'
    at webpackMissingModule (/home/syx/code/desktop/dist/main.js:14205:84)
    at Object../node_modules/_electron-updater@4.6.5@electron-updater/out/AppUpdater.js (/home/syx/code/desktop/dist/main.js:14205:170)
    at __webpack_require__ (/home/syx/code/desktop/dist/main.js:20:30)
    at Object../node_modules/_electron-updater@4.6.5@electron-updater/out/main.js (/home/syx/code/desktop/dist/main.js:16516:20)
    at __webpack_require__ (/home/syx/code/desktop/dist/main.js:20:30)
    at Object../src/splashscreen.ts (/home/syx/code/desktop/dist/main.js:71674:19)
    at __webpack_require__ (/home/syx/code/desktop/dist/main.js:20:30)
    at Object../src/winsmanager.ts (/home/syx/code/desktop/dist/main.js:71957:22)
    at __webpack_require__ (/home/syx/code/desktop/dist/main.js:20:30)
    at Object../src/main.ts (/home/syx/code/desktop/dist/main.js:70800:21)
Gtk-Message: 15:02:25.098: Failed to load module "canberra-gtk-module"

网上说的最多的解决办法一是说因为node的版本太低导致的,查看electron-builder的代码可以发现,里面都是require("fs/promises")这样的引用,但旧版node是require("fs").promises的引用方式。但试了很多node版本之后并没有解决问题。
二是替换node_modules文件夹中electron-builder文件夹下require("fs/promises")为require("fs").promises;没试过这样办法。
根据上述错误提示,找到node_modules下的electron_updater的AppUpdater.js文件,将require("fs/promises")改为require("fs").promises发现能运行。因为大概半年之前工程还是能运行的,后来就想到锁定版本试试,就把package.json中的"electron-updater":"^4.3.5"改为"electron-updater":"4.3.5",然后就能运行了。

electron打包后启动应用,提示cannot find module fs/promises的解决相关推荐

  1. cnpm提示,cannot find module ‘fs/promises

    cnpm提示,cannot find module 'fs/promises 问题 全局安装 cnpm 后,执行 cnpm 命令出现了下面错误: cannot find module 'fs/prom ...

  2. electron 打包后启动应用报错:Error: ENOENT: no such file or directory, open ‘xxx/manifest.json‘‘

    使用 electron-builder 打包后启动报错: Reading /xxx/manifest.json failed. Error: ENOENT: no such file or direc ...

  3. spring boot 在eclipse里启动正常,但打包后启动不起来

    现象描述: spring boot 在eclipse里启动正常,但打包后启动不起来. 错误日志如下: D:\Project>java -jar MKKY_CMS.jar. ____ _ __ _ ...

  4. 0 win10重装partition_win10系统重装后启动时提示invalid partition table的详细方案

    有关win10系统重装后启动时提示invalid partition table的操作方法想必大家有所耳闻.但是能够对win10系统重装后启动时提示invalid partition table进行实 ...

  5. 安装centos后 启动mysqld显示mysqld: 未被识别的服务 解决方法

    安装centos后 启动mysqld显示mysqld: 未被识别的服务 解决方法 参考文章: (1)安装centos后 启动mysqld显示mysqld: 未被识别的服务 解决方法 (2)https: ...

  6. Driver not loaded Driver not loaded(QT打包后在别人的电脑上运行出现这个错误)解决方法

    Driver not loaded Driver not loaded(QT打包后在别人的电脑上运行出现这个错误)解决方法 出现这个错误,导致的原因有很多,所以不妨先试试我找的这种解决方法,我也是试过 ...

  7. electron 打包后找不到module问题

    使用electron时调用了nodejs模块,在vscode调试时没有问题,打成exe包后运行报找不到module的erro.这个错误是因为打包时没有把使用的module编译,解决办法是手动在pack ...

  8. electron打包后在win7上打开异常KERNEL32.dll

    第一次使用electron时,用户需在win7上能安装exe应用 打包后放到win7打开出现'无去定位程序输从点 GetPackagefamnilName 动态链接库KERNEL32.dll' 最终发 ...

  9. 为Electron 打包后的桌面程序添加自定义向导

    Electron打包 简介 内容 创建package.json 下载打包依赖 添加打包配置----在srcripts下面添加build(此处添加自定义安装向导向导) 配置信息说明 Boolean St ...

最新文章

  1. 基于libmad库的MP3解码简析
  2. 阿里云服务器ECS Linux系统分析nginx或apache当天访问最多的IP
  3. 通过缓存数据库结果提高PHP性能(转)
  4. python培训班时间 费用-深圳python培训班大概多少费用
  5. RedHat Linux网络配置过程笔记
  6. NYOJ 586 疯牛 POJ 2456(二分搜索 + 贪心)
  7. 在oracle中使用Trigger
  8. 使用Hibernate(JPA)一键式删除
  9. oracle安装 redo log file,Oracle Dump Redo Log File 说明
  10. CSS——基础选择器
  11. gpio驱动蜂鸣器出现破音_五款蜂鸣器驱动电路原理图
  12. php图片颤抖,PHP 判断图片是否带点赞(以抖音为例)
  13. Linux系统利用C语言获取网口信息(IP地址,MAC地址,状态,带宽speed等)
  14. 计算机双行文本一般应用在什么地方,全国计算机二级MS office操作试题及答案
  15. 重拾Excel之为什么
  16. java经典错误语句_【Java】Java代码经典错误清单
  17. ArcEngine代码 地图制图标注之 TextElement标注,Annotation注记,MapTips显示
  18. yum 与pip区别
  19. 台式计算机光标时不时跳动,苹果电脑打字乱跳光标怎么办?MacBook打字时光标乱跳的解决办法...
  20. Monte-Carlo算法(基本原理,理论基础,应用实践)

热门文章

  1. three.js添加一个圆柱体
  2. linux下最好用的mplayer播放器使用方法(转)
  3. python如何爬取图片_百度图片爬虫-python版-如何爬取百度图片?
  4. SQL每日一题(20210824)假设计算日期是从2021-7-13开始计算,PENDING_DAYS表示到货还需要的天数
  5. Vue 教程(十八)template 标签
  6. maven制作脚手架
  7. 多目标差分进化算法(Matlab代码实现)
  8. java filesaver获取文件名_FileSaver
  9. 【递推】常见的递推关系
  10. EDA大作业:霓虹灯电路设计