'How to set custom executable icon using electron-packager?

Entered image

I have successfully built an Electron app. Now I'm trying to change the icon of the .exe that is generated by electron-packager. However, the .exe gets the default Electron icon, not my own icon (see screenshot).

The command I run: npm run build

The corresponding script in package.json:

"build": "electron-packager --out winx64 --overwrite --platform win32 --appname clientlmcenter . --icon my_logo.ico"

The file my_logo.ico is present in the root directory.



Solution 1:[1]

You have to put icon argument like this

--icon=./my_logo.ico

Also make sure the logo is in the current directory where you execute npm run build

Solution 2:[2]

Another solution that I found is adding the icon in the packaje.json taking into account that the icon is in the root.

{
  "name": "nameAplication",
  "version": "1.0.0",
  "icon": "favicon.ico",
}

and when creating the executable add this command

electron-packager . --platform=win32 --arch=x64 --icon=favicon.ico

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Sharvin K
Solution 2 Michael Parra