Electron-builder: iconUrl parameter isn't working

Created on 12 Jun 2016  Â·  11Comments  Â·  Source: electron-userland/electron-builder

When I'm trying to build package for windows with iconUrl property(like documentation says) it fails by trying to retrieve file from default location. Seems like there is no check for specific icon - source.

Output:

➜  pomodoro git:(master)  npm run package

> [email protected] package /Users/g07cha/Projects/pomodoro
> build -w

Skip app dependencies rebuild because dev and app dependencies are not separated
Error: ENOENT: no such file or directory, open '/Users/g07cha/Projects/pomodoro/build/icon.ico'
    at Error (native)
From previous event:
    at /Users/g07cha/Projects/pomodoro/node_modules/electron-builder/src/winPackager.ts:126:24
    at undefined.next (native)
From previous event:
    at tsAwaiter (/Users/g07cha/Projects/pomodoro/node_modules/electron-builder/src/awaiter.ts:10:47)
    at Object.build (/Users/g07cha/Projects/pomodoro/node_modules/electron-builder/src/builder.ts:182:52)
    at Object.<anonymous> (/Users/g07cha/Projects/pomodoro/node_modules/electron-builder/src/build-cli.ts:8:28)
    at Module._compile (module.js:541:32)
    at Object.Module._extensions..js (module.js:550:10)
    at Module.load (module.js:456:32)
    at tryModuleLoad (module.js:415:12)
    at Function.Module._load (module.js:407:3)
    at Function.Module.runMain (module.js:575:10)
    at startup (node.js:160:18)
    at node.js:445:3

Part of "package.json" file, you could see whole file here

"build": {
    "productName": "Pomodoro",
    "app-bundle-id": "com.g07cha.pomodoro",
    "app-category-type": "public.app-category.productivity",
    "osx": {
      "background": "build/background.png",
      "icon": "build/icon.icns",
      "contents": [
        {
          "x": 320,
          "y": 250,
          "type": "link",
          "path": "/Applications"
        },
        {
          "x": 70,
          "y": 250,
          "type": "file"
        }
      ]
    },
    "win": {
      "iconUrl": "https://github.com/G07cha/pomodoro/blob/master/icons/icon.ico?raw=true"
    }
question windows

All 11 comments

Windows requires icon file. We don't use iconUrl to get icon because iconUrl it is a Squirrel.Windows sh*t. Our NSIS target doesn't require icon url (but it is not yet production ready).

@develar sorry but seems like I didn't clarify problem enough, there are two paragraphs in documentation which points to iconUrl:

  1. https://github.com/electron-userland/electron-builder#in-short
  2. https://github.com/electron-userland/electron-builder/wiki/Options#buildwin

So if "electron-builder" don't use iconUrl maybe we should remove this from docs?
Also, we still need an icon for apps itself, which variable points windows icon for "electron-packager" in this case?

We pass iconUrl to squirrel as is. "We don't use" — I mean that we don't download it if build/icon.ico doesn't exist. But iconUrl is required for squirrel target in any case.

For packager we use build.icon option and by default we use build/icon.ico file (it is recommended way to set icon).

@develar oh, now I understand how it works, thank you, but again, I think we need to specify it in documentation.

Pull request welcome.

Sorry, I can't agree with this solution. First of all this requires you to have internet access to create an installer (which is totaly ridiculous), which not all build servers do, since some of them are on-premises. Secondly, why can it not default to a local file? If you specify it, why can't it use the file:/// protocol? Now I need to host an icon on my server (no, I don't use github to store my code) to build my installer???

Apparently it's a nuget limitation..

@bravecobra please use nsis target and forget about ugly squirrel.windows.

@develar I want(ed) to use the auto-update features of the release service, but apparently that doesn't work for linux either, so, yes sure nsis target starts to sound appealing now...

Squirrel.windows is finally working for me. A good boilerplate to try is Skelektron (https://github.com/BZCoding/SkelEktron).

One weird quirk I've found when building for Windows Squirrel is that it will always come up with the _iconUrl not defined error_ unless you define a valid github repository in the parent package.json file (I just use the one for the boilerplate Skelektron). I'm building on my Mac (el capitan) using latest Wine installed via Homebrew. I've tested this by removing the repository or trying to use a gitlab repository address.

The error goes away whenever there's a valid github repo defined as follows :

"repository": {
    "type": "git",
    "url": "https://github.com/BZCoding/SkelEktron.git"
  },

Just make sure they are either here for Mac OSX : "build/icon.icns" or here for Windows : "build/icon.ico"

I doubt this is intended behavior or that very many people have noticed this strange quirk, but I thought I would share this so that maybe I could save a couple people from pulling their hair out.

@dmdewey Squirrel.windows is deprecated, please use NSIS. #529 is ready to close.

Thanks for you investigation and comment.

is intended behavior or that very many people have noticed this strange quirk,

A lot of people can ask only WTF when iconUrl is required to be http link. It is one of the reasons why Squirrel.Windows is deprecated and NSIS will be default target for windows soon.

Was this page helpful?
0 / 5 - 0 ratings