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

文章目录

  • yarn下载的包不支持require()
  • winCodeSign-2.6.0.7z下载失败
  • nsis-3.0.4.1.7z下载失败
  • 待补充...

yarn下载的包不支持require()

报错内容:

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

【Electron】electron-builder打包失败问题记录_第1张图片

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

【Electron】electron-builder打包失败问题记录_第2张图片

待补充…

你可能感兴趣的:(electron,javascript,前端)