node.jselectronelectron-forge

building electron using forge gives an error


i want to build this electron app but it gives me an error when i type npm run make the error: 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 i installed git from https://git-scm.com/download/win but still the same problem this is the package.JSON file:

    "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"
    }
}

Edit

i restarted VS code and now this is happening

✔ 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)

Edit 2


this is the 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: {},
    },
  ],
};

Solution

  • Update: I've added this in package.json inside the "makers" and it just worked:

          "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": {}
            }
          ]