【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

待补充...

相关推荐
不cong明的亚子34 分钟前
web live多屏互动平台
javascript·经验分享·音视频
陆枫Larry42 分钟前
Astro 是什么
前端
是立不是利2 小时前
写给设计师的 CSS 博客美学指南
前端·css
dsyyyyy11013 小时前
JS复习,难点,易错点总结
开发语言·javascript·ecmascript
默_笙3 小时前
🏝 Docker 就是"房地产开发":从施工图纸到小区物业的容器化指南
前端·javascript
计算机魔术师3 小时前
Rohan Paul 谈用时间跨度衡量智能体能力,并引用 OpenAI 自动化研究实习生里程碑
前端
kyriewen3 小时前
我手写了个极简版 React Router——才搞懂 v6 为什么砍了这么多 API
前端·javascript·程序员
a1117763 小时前
Shirone 二次元博客主题 开源
前端·开源
IT_陈寒3 小时前
Python的切片赋值把我坑惨了,这不是bug是特性
前端·人工智能·后端
掘金酱3 小时前
【社区公告】致每一位掘友:关于这次调整, 想再说几句
前端·人工智能