【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

待补充...

相关推荐
m0_748255261 小时前
前端安全——敏感信息泄露
前端·安全
鑫~阳3 小时前
html + css 淘宝网实战
前端·css·html
Catherinemin3 小时前
CSS|14 z-index
前端·css
2401_882727574 小时前
低代码配置式组态软件-BY组态
前端·后端·物联网·低代码·前端框架
NoneCoder4 小时前
CSS系列(36)-- Containment详解
前端·css
anyup_前端梦工厂5 小时前
初始 ShellJS:一个 Node.js 命令行工具集合
前端·javascript·node.js
5hand5 小时前
Element-ui的使用教程 基于HBuilder X
前端·javascript·vue.js·elementui
GDAL5 小时前
vue3入门教程:ref能否完全替代reactive?
前端·javascript·vue.js
六卿5 小时前
react防止页面崩溃
前端·react.js·前端框架
z千鑫5 小时前
【前端】详解前端三大主流框架:React、Vue与Angular的比较与选择
前端·vue.js·react.js