【Electron】electron-builder打包失败问题记录

文章目录

yarn下载的包不支持require()

报错内容:

bash 复制代码
var stringWidth = require('string-width')
                  ^
Error [ERR_REQUIRE_ESM]: require() of ES Module /stuff/node_modules/string-width/index.js from /stuff/node_modules/wide-align/align.js not supported.
Instead change the require of index.js in /stuff/node_modules/wide-align/align.js to a dynamic import() which is available in all CommonJS modules.
    at Object.<anonymous> (/stuff/node_modules/wide-align/align.js:2:19)
    at Object.<anonymous> (/stuff/node_modules/gauge/render-template.js:2:13)
    at Object.<anonymous> (/stuff/node_modules/gauge/plumbing.js:3:22)
    at Object.<anonymous> (/stuff/node_modules/gauge/index.js:2:16)
    at Object.<anonymous> (/stuff/node_modules/npmlog/log.js:3:13)
    at Object.<anonymous> (/stuff/node_modules/@mapbox/node-pre-gyp/lib/node-pre-gyp.js:23:13)
    at Object.<anonymous> (/stuff/node_modules/@mapbox/node-pre-gyp/lib/main.js:9:22)
    at Object.<anonymous> (/stuff/node_modules/@mapbox/node-pre-gyp/bin/node-pre-gyp:4:1) {

github issue

复制代码
https://github.com/isaacs/jackspeak/issues/5

解决方法:

不用yarn下载,改用npm

winCodeSign-2.6.0.7z下载失败

复制代码
https://registry.npmmirror.com/binary.html?path=electron-builder-binaries/winCodeSign-2.6.0/

下载后找到以下位置,将压缩包解压到electron-builder的cache文件夹中

复制代码
C:\Users\admin\AppData\Local\electron-builder\Cache

nsis-3.0.4.1.7z下载失败

复制代码
https://registry.npmmirror.com/binary.html?path=electron-builder-binaries/nsis-3.0.4.1/

下载后找到以下位置,将压缩包解压到electron-builder的cache文件夹中

复制代码
C:\Users\admin\AppData\Local\electron-builder\Cache\nsis

待补充...

相关推荐
醉城夜风~1 天前
CSS元素显示模式(display)
前端·css
AI大模型-小华1 天前
Codex 三方充值快速入门指南
java·前端·数据库·chatgpt·ai编程·codex·chatgpt pro
做前端的娜娜子1 天前
同一链接实现 PC Web 与移动 H5 自适应
前端·掘金·金石计划
小帅不太帅1 天前
架构没变、规模没变,DeepSeek V4 Flash 正式版凭什么暴涨 47 分?
前端·aigc·deepseek
jarvisuni1 天前
DeepSeekFlash前端依旧拉垮,而且变慢了很多!
前端·javascript·算法
卷福同学1 天前
AI编程出海第二步:验证关键词能否做站
前端·人工智能·后端
赵庆明老师1 天前
Vben精讲:21-详解web-antd:tsconfig.json
前端·json·vim
wc881 天前
微软EDGE浏览器功能学习
前端·学习·edge
破z晓1 天前
javascript 导出excel表
开发语言·javascript·excel