electron打包 Error output: !include: could not find:

Error output:
2 !include: could not find: "C:\Users\xxxx(这里是中文)\AppData\Local\Temp\t-TH3KzB\0-messages.nsh"
3 Error in script "<stdin>" on line 75 -- aborting creation process

这个报错意思是路径有中文存在,解析不到,完整的错误显示如下:

Error output:
!include: could not find: “C:\Users\xxxx(这里是中文)\AppData\Local\Temp\t-TH3KzB\0-messages.nsh”
Error in script “” on line 75 – aborting creation process

at ChildProcess.<anonymous> (D:\electron-learing\electron-record-learn\record-project\node_modules\builder-util\src\util.ts:250:14)
at Object.onceWrapper (node:events:642:26)                                                       s\builder-util\src\util.ts:250:14)
at ChildProcess.emit (node:events:527:28)
at ChildProcess.cp.emit (D:\electron-learing\electron-record-learn\record-project\node_modules\cross-spawn\lib\enoent.js:34:29)
at maybeClose (node:internal/child_process:1092:16)
at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5) {

exitCode: 1,
alreadyLogged: false,
code: ‘ERR_ELECTRON_BUILDER_CANNOT_EXECUTE’
}

把编译出来的乱码用utf-8来编译:
找到 node_module/app-builder-lib/out/targets/nsis/NsisTarget.js文件,在 executeMakensis 方法中加入相应的代码,

async executeMakensis(defines, commands, script) {
    const args = this.options.warningsAsErrors === false ? [] : ["-WX"];
    //添加下面这一行即可
      args.push("-INPUTCHARSET", "UTF8");
    for (const name of Object.keys(defines)) {
        const value = defines[name];

    if (value == null) {
        args.push(`-D${name}`);
    } else {
        args.push(`-D${name}=${value}`);
        }
    }
}
  • 3
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值