Error output:
2 !include: could not find: "C:Usersxxxx(这里中文)AppDataLocalTempt-TH3KzB-messages.nsh"
3 Error in script "<stdin>" on line 75 -- aborting creation process

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

Error output:
!include: could not find: “C:Usersxxxx(这里是中文)AppDataLocalTempt-TH3KzB-messages.nsh
Error in script “” on line 75 – aborting creation process

at ChildProcess.<anonymous> (D:electron-learingelectron-record-learnrecord-projectnode_modulesbuilder-utilsrcutil.ts:250:14)
at Object.onceWrapper (node:events:642:26)                                                       sbuilder-utilsrcutil.ts:250:14)
at ChildProcess.emit (node:events:527:28)
at ChildProcess.cp.emit (D:electron-learingelectron-record-learnrecord-projectnode_modulescross-spawnlibenoent.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/appbuilder-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}`);
        }
    }
}

原文地址:https://blog.csdn.net/carry_666/article/details/134674874

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任

如若转载,请注明出处:http://www.7code.cn/show_33564.html

如若内容造成侵权/违法违规/事实不符,请联系代码007邮箱suwngjj01@126.com进行投诉反馈,一经查实,立即删除

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注