electron 使用Forge构建电子邮件会产生错误

jpfvwuh4  于 2023-02-06  发布在  Electron
关注(0)|答案(1)|浏览(419)

我想建立这个电子应用程序,但它给我一个错误,当我键入npm run make错误:It looks like you are missing some dependencies you need to get Electron running. Make sure you have git installed and Node.js version >= 14.17.5我从https://git-scm.com/download/win安装了git,但仍然有同样的问题,这是package.JSON文件:

"name": "OverStat",
    "version": "1.0.0",
    "main": "main.js",
    "devDependencies": {
        "@electron-forge/cli": "^6.0.4",
        "electron": "^22.0.0",
        "electron-reloader": "^1.2.3"
    },
    "scripts": {
        "start": "electron .",
        "make": "electron-forge make"
    },
    "dependencies": {
        "electron-builder": "^23.6.0"
    }
}

编辑

我重新启动了VS代码,现在发生了这种情况

✔ Checking your system
✔ Loading configuration
✖ Resolving make targets
  › Could not find any make targets configured for the "win32" platform.
◼ Running package command
◼ Running preMake hook
◼ Making distributables
◼ Running postMake hook

An unhandled rejection has occurred inside Forge:
Error: Could not find any make targets configured for the "win32" platform.
at Task.task (D:\projects\electron learning\node_modules\@electron-forge\core\dist\api\make.js:122:27)
    at Task.run (D:\projects\electron learning\node_modules\listr2\dist\index.cjs:978:35)

编辑2

这是forge.config.js文件:

module.exports = {
  packagerConfig: {},
  rebuildConfig: {},
  makers: [
    {
      name: '@electron-forge/maker-squirrel',
      config: {},
    },
    {
      name: '@electron-forge/maker-zip',
      platforms: ['darwin'],
    },
    {
      name: '@electron-forge/maker-deb',
      config: {},
    },
    {
      name: '@electron-forge/maker-rpm',
      config: {},
    },
  ],
};
cgfeq70w

cgfeq70w1#

更新:我在"makers"中的package.json中添加了这个,它刚刚工作:

"makers": [
        {
          "name": "@electron-forge/maker-squirrel",
          "config": {
            "name": "electron_quick_start"
          }
        },
        {
          "name": "@electron-forge/maker-zip",
          "platforms": [
            "darwin"
          ]
        },
        {
          "name": "@electron-forge/maker-deb",
          "config": {}
        },
        {
          "name": "@electron-forge/maker-rpm",
          "config": {}
        }
      ]

相关问题