packager: rcedit.exe failed with exit code 1. Fatal error: Unable to set icon

Electron packager doesn’t accept my icon file even though it is in the right dimensions and format. Icon.zip

PS C:\Users\abornst\Documents\ovt> electron-packager . CNTKVideoTagger --platform=win32 --icon=Icon.ico --arch=x64
Packaging app for platform win32 x64 using electron v1.6.2
rcedit.exe failed with exit code 1. Fatal error: Unable to set icon
PS C:\Users\abornst\Documents\ovt> electron-packager . CNTKVideoTagger --platform=win32 --icon=.Icon.ico --arch=x64
Packaging app for platform win32 x64 using electron v1.6.2
Wrote new app to C:\Users\user\Documents\ovt\CNTKVideoTagger-win32-x64

About this issue

  • Original URL
  • State: closed
  • Created 10 years ago
  • Comments: 25 (13 by maintainers)

Most upvoted comments

This is how I resolved the issue.

I had an macOS icon file named icons.icns and a Windows icon file named icon.ico. This was my packagerConfig:

"electronPackagerConfig": {
	"packageManager": "npm",
	"icon": "./src/assets/images/icons.icns",
	"asar": true
},

No matter what I specified in my electronWinstallerConfig I was still getting this error, even if I removed the icon key from it. I finally tracked down the issue by finding my globally installed electron-forge and adding a console.log to the rcedit.js file. It turns out that rcedit was taking the the path from electronPackagerConfig and ignoring the electronWinstallerConfig, then just renaming the extension to .ico. So rcedit couldn’t find ./src/assets/images/icons.ico because it didn’t exist.

Long story short: rename your icon files to have the same base name and in the same folder. In my case I now have these:

src/assets/images/icons.icns src/assets/images/icons.ico

And everything works.

FWIW, I was seeing this same error when I tried building without an .ico file in the same directory as the .png specified in the config.

  "electronPackagerConfig": {
    "packageManager": "npm",
    "icon": "./src/assets/imgs/icon-1024.png"
  },
screen shot 2018-04-21 at 2 09 32 pm

Following what @jaaromy did. I fixed mine with a config that looks like this:

electronPackagerConfig: {
  icon: "src/assets/images/logo-icon.icns"
},
electronWinstallerConfig: {
  iconUrl: "src/assets/images/logo-icon.ico"
},

If everything you say is accurate, then I’m inclined to believe that it’s a bug in rcedit. Packager doesn’t do anything except pass the icon path to rcedit, and it modifies the executable accordingly.