美文网首页
electron 报错:Application entry fi

electron 报错:Application entry fi

作者: 西叶web | 来源:发表于2023-07-15 14:14 被阅读0次

    场景

    使用 electron-builder ,编写js脚本打包,报错

    环境

    "electron": "22.0.0",
    "electron-builder": "^23.6.0",

    相关代码

    import * as electronBuilder from "electron-builder";
    electronBuilder.build({
            config: {
              directories: {
                output: outputDir,
                app: appPathDir,
              },
              asar: true,
              appId: "com.ikun.app",
              productName: "electron-app",
              nsis: {
                oneClick: false,
                allowToChangeInstallationDirectory: true,
              },
            },
          });
    

    报错

    Application entry file "background.js" in the "D:\xxxxx\dist\win-unpacked\resources\app.asar" does not exist. Seems like a wrong configuration.

    解决

    electronBuilder.build({
            config: {
              directories: {
                output: outputDir,
                app: appPathDir,
              },
              asar: true,
              appId: "com.ikun.app",
              productName: "electron-app",
              nsis: {
                oneClick: false,
                allowToChangeInstallationDirectory: true,
              },
    +++   files: ["background.js"],
            },
    });
    
    

    原因

    查看app.asar文件里少了background.js的内容

    相关文章

      网友评论

          本文标题:electron 报错:Application entry fi

          本文链接:https://www.haomeiwen.com/subject/jgobudtx.html