【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

待补充...

相关推荐
Hilaku12 分钟前
为什么我在团队里禁止使用 axios?
前端·javascript·程序员
兮动人13 分钟前
Chrome 152 升级后本地请求全挂了?是 LNA 策略在搞事
前端·chrome·lna·local network
一只游鱼17 分钟前
我用原生 JS 做了一个「会呼吸」的博客:Canvas 水境 + 合成音效 + 会破裂的留言气泡(vibe coding)
javascript·agent·canvas·github pages
JarvanMo22 分钟前
让 3D 在 Flutter 中焕发生机:Flutter GPU 与 flutter_scene 实战经验
前端
狂师1 小时前
太强了!GitHub上开源了一款AI自动化测试框架,0代码搞定前后端测试!
前端·后端·测试
只睡四小时1 小时前
Local-First 数据契约:一张表装下 4 类数据
前端·javascript·架构设计·local-first·数据契约
迅猛龙办公室1 小时前
Python函数实现反转一个只有3位数的整数
开发语言·前端·python
我星期八休息1 小时前
Redis 的原理和使用(2)
前端·数据库·redis·python·mysql·缓存·bootstrap
Java后端的Ai之路1 小时前
19-ReactJS最佳实践
前端·react.js·前端框架
溪语流沙1 小时前
【Web全栈进阶】文件上传与图片展示:早报站的第一张图片
前端·vue.js·python·fastapi