Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows icon path unquoted, leads to error #3889

Open
jandrieu opened this issue May 13, 2019 · 13 comments
Open

Windows icon path unquoted, leads to error #3889

jandrieu opened this issue May 13, 2019 · 13 comments

Comments

@jandrieu
Copy link

  • Version: electron-builder@20.40.2
  • Target: Windows

In my windows configuration, I use the following:

    "win": {
      "target": "zip",
      "icon" : "logos/favicon/Favicon.ico"
    }  

And the release command:

"release": "npm test && npm run generate-license && webpack --config=build/webpack.app.config.js --env=production && electron-builder",

When I run "npm run release", I get an error because the windows file path is not quoted, so drive "C" is the attempted target for finding an icon:

  • electron-builder version=20.40.2
  • loaded configuration file=package.json ("build" field)
  • no native production dependencies
  • packaging       platform=win32 arch=x64 electron=2.0.2 appOutDir=dist\win-unpacked
Error: Exit code: 1. Command failed: C:\Users\Joe\AppData\Local\electron-builder\Cache\winCodeSign\winCodeSign-2.4.0\rcedit-ia32.exe C:\Users\Joe\Documents\Organizations\Satyrn\satyrn\dist\win-unpacked\Satyrn.exe --set-version-string FileDescription Satyrn --set-version-string ProductName Satyrn --set-version-string LegalCopyright Copyright © 2019 Joe Andrieu --set-file-version 0.0.0 --set-product-version 0.0.0.0 --set-version-string InternalName Satyrn --set-version-string OriginalFilename  --set-version-string CompanyName Joe Andrieu --set-icon C:\Users\Joe\Documents\Organizations\Satyrn\satyrn\logos\favicon\Favicon.ico
Reserved header is not 0 or image type is not icon for 'C'
Fatal error: Unable to set icon

Reserved header is not 0 or image type is not icon for 'C'
Fatal error: Unable to set icon

    at C:\Users\Joe\Documents\Organizations\Satyrn\satyrn\node_modules\builder-util\src\util.ts:126:16

[I snipped the rest of the trace]

Note: the constructed file path for the icon is correct. If it were just quoted, I believe this would work.

I looked through the source, but my initial inspection did not find the spot where the command is constructed.

Any pointers would be appreciated.

@HarounAns
Copy link

I'm also running into this problem, not sure if there are workarounds to set the application icon on windows or not

@jandrieu
Copy link
Author

jandrieu commented Jul 6, 2019

Someone who knows the code base should be able to update the open to use a well-structured path rather than just throw the string into the function. I'm just not sure where it is. We went ahead and shipped our MVP without an icon, but it's an issue we'd still like to see fixed.

@develar
Copy link
Member

develar commented Jul 6, 2019

Please specify your windows version and arch (32 or 64 bit).

@HarounAns
Copy link

For me its 64bit Windows 10

@jandrieu
Copy link
Author

jandrieu commented Jul 7, 2019

Me too.

@develar
Copy link
Member

develar commented Jul 7, 2019

it is not electron-builder issue. But it doesn't matter for you as end user. I am investigating why it is broken.

develar added a commit to develar/electron-builder that referenced this issue Jul 7, 2019
@develar
Copy link
Member

develar commented Jul 7, 2019

Please try 21.0.11

develar added a commit to develar/electron-builder that referenced this issue Jul 8, 2019
@wind-hx
Copy link

wind-hx commented Apr 22, 2020

Please try 21.0.11

image

@zykoikaze
Copy link

Has this problem been solved?

@lvsouza
Copy link

lvsouza commented Nov 18, 2020

I had this same problem. In my case the problem was in the format of the single image. I used a different converter for the ico format and it worked without problems.

I hope it helps you!

@anshluu
Copy link

anshluu commented May 7, 2022

I had this same problem. In my case the problem was in the format of the single image. I used a different converter for the ico format and it worked without
problems.

I hope it helps you!

Thank you so much, this was perfect! This bug should be closed.

Detailed Explanation: When compiling with Electron Packager/Builder, I got this:
WARNING: Could not find icon "C:\Users\AM\electron-quick-start\icon.ico", not updating app icon
This told me that it was automatically searching for a .ico file. So I decided to rename the file from icon.png to icon.ico. This might of changed the file type, but the binaries of PNG wouldnt be converted to ICO. You need to use an PNG to ICO converter for this. Thank you to @lvsouza for sparking this answer!

@lucaslgr
Copy link

Thanks !!
I've used this website to convert from png to ico choosing the size and without any background as png could provide
https://redketchup.io/icon-converter

@RolandDaum
Copy link

Jo guys. Make sure your Icon is actually an .ico and not just a changned png with a different file ending!!!!

https://redketchup.io/icon-converter

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants