Home > Software engineering >  Electron-forge - An unhandled rejection has occurred inside Forge: [object Object]
Electron-forge - An unhandled rejection has occurred inside Forge: [object Object]

Time:11-19

Tried to build an electron based app by running npm run make in terminal, everything went fine except when it had to go thru Making distributables. Out folder has been created but app is not bundled in one exe.

dependencies in Package.json

  "devDependencies": {
    "@electron-forge/cli": "^6.0.3",
    "@electron-forge/maker-deb": "^6.0.3",
    "@electron-forge/maker-rpm": "^6.0.3",
    "@electron-forge/maker-squirrel": "^6.0.3",
    "@electron-forge/maker-zip": "^6.0.3",
    "electron": "^6.1.12"
  },

config in 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: {},
    },
  ],
};

Full error I'm getting
any solutions?

CodePudding user response:

Make sure you have author property not empty in package.json like so: "author": "John".

Here is a full example:

{
  "name": "test",
  "version": "1.0.0",
  "description": "test",
  "main": "index.js",
  "scripts": {
    "start": "electron-forge start",
    "package": "electron-forge package",
    "make": "electron-forge make"
  },
  "author": "John",
  "license": "ISC",
  "devDependencies": {
    "@electron-forge/cli": "^6.0.3",
    "@electron-forge/maker-deb": "^6.0.3",
    "@electron-forge/maker-rpm": "^6.0.3",
    "@electron-forge/maker-squirrel": "^6.0.3",
    "@electron-forge/maker-zip": "^6.0.3",
    "electron": "^21.2.3"
  },
  "dependencies": {
    "electron-squirrel-startup": "^1.0.0"
  }
}

It seems like a weird bug, but this fix worked for me.

CodePudding user response:

I ran into the exact same issue and I fixed it by writing something in the description in the package.json file.

{
  ...
  description: "an electron test app",
  ...
}

https://www.electronforge.io/config/makers/squirrel.windows#in-package.json

  • Related