3

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.

snwflk
  • 3,341
  • 4
  • 25
  • 37
karansys
  • 2,449
  • 7
  • 40
  • 78
  • Please extend your question to include your build process (with the command line call, configuration if necessary, etc.). – snwflk May 29 '19 at 17:22
  • Thank you I will do that – karansys May 29 '19 at 17:23
  • I can't reproduce the problem. Have you checked that the ICO is ok? Have you tried a different ICO file? – snwflk May 29 '19 at 17:45
  • yes .ico is ok, – karansys May 29 '19 at 18:28
  • I'd advise that you try this with a new project, and check if it works. Then you know whether it works in principle for you. Then slowly add stuff back to approach your actual project ("bisect"). At some point you will find the culprit. Keep in mind that the Electron version may matter as well. – snwflk May 29 '19 at 20:43

2 Answers2

3

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

Sharvin K
  • 697
  • 3
  • 10
1

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
  • for changing the icon of the file, this was the solution I was looking for. For setting the icon of the application during run time, the accepted answer of Sharvin K was the one I was looking for – HerChip Feb 17 '23 at 13:32