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

Can not build success cause of icon set #485

Open
JungleHH opened this issue Apr 28, 2024 · 10 comments · May be fixed by #487
Open

Can not build success cause of icon set #485

JungleHH opened this issue Apr 28, 2024 · 10 comments · May be fixed by #487
Labels
bug Something isn't working

Comments

@JungleHH
Copy link

I set my icon in package.json as

build": {  
      "productName": "xx",  
      "appId": "xxx.xx.xx",  
      "win": {  
        "icon": "icon.png" 
      }, 
      "nsis": { 
        "oneClick": false, 
        "guid": "idea", 
        "perMachine": true, 
        "allowElevation": true, 
        "allowToChangeInstallationDirectory": true, 
        "installerIcon": "icon.png", 
        "uninstallerIcon": "icon.png", 
        "createDesktopShortcut": true, 
        "createStartMenuShortcut": true, 
        "shortcutName": "idea" 
      } 
    }

whatever image i set , it throws error failed ERR_ELECTRON_BUILDER_CANNOT_EXECUTE and Error while loading icon from "xxxxxxxxxx\webapp\icon.png": invalid icon file.
I know this error comes from NSIS, but I have used NSIS which installed on my computer to package other application with this .png file.
so, what should I set the shortcut icon correctly?

@JungleHH JungleHH added the bug Something isn't working label Apr 28, 2024
@RSS1102
Copy link
Member

RSS1102 commented Apr 28, 2024

@JungleHH
Copy link
Author

@RSS1102 Really Thanks for your reply!
I guess no. If the directory path were wrong, the error will be another one (i have tried)
But maybe I am wrong : ) Is there a example for set shortcut icon? I have searched it in example project, but not found it .

@RSS1102
Copy link
Member

RSS1102 commented Apr 28, 2024

try it?
image

@JungleHH
Copy link
Author

Unfortunately, it does not work

@RSS1102
Copy link
Member

RSS1102 commented Apr 28, 2024

I can use a template to add this. Perhaps you can provide your minimum demo?

@JungleHH
Copy link
Author

@RSS1102 oh my god, I convert the .png to .ico, then it works! But why? NSIS document says we can set it both of .png and .ico.
Additionally, there is a new problem, when i install and open my packaged program, the page shows blank. ( In detail, there is a square rotating and then disappeared) .
I just use your template, create a build folder manually and add build into package.json

@RSS1102
Copy link
Member

RSS1102 commented Apr 28, 2024

.png to .ico :Let me review the code and instructions.

the page shows blank:
If it is in dev mode, it is possible that the resource.map cache may cause lag (possibly several tens of seconds). If it is a product opened after build, this problem should not occur.
image

@JungleHH
Copy link
Author

JungleHH commented Apr 29, 2024

@RSS1102 Hi, Thanks for your help. I have fixed it.

    "win": {
      "icon": "public/logo.ico",
      "target": [
        {
          "target": "nsis",
          "arch": [
            "x64"
          ]
        }
      ]
    }

I add target option to win, it seems that we must indicate the arch explicitly. I'm not familiar with NSIS :(
You can close this issue ( or maybe tell me more about the difference between png and ico in NSIS hahah).
Thank you!

@RSS1102 RSS1102 linked a pull request May 2, 2024 that will close this issue
4 tasks
@RSS1102
Copy link
Member

RSS1102 commented May 2, 2024

@JungleHH *. png is possible.
image
image

@JungleHH
Copy link
Author

JungleHH commented May 8, 2024

Ah it's so odd, can you show the metadata of your png?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants