Electron-builder: [install-app-deps] what does it do?

Created on 7 Aug 2017  Â·  18Comments  Â·  Source: electron-userland/electron-builder

hi,

I am cleaning up my project and and to change install-app-deps to electron-builder install-app-deps
now i can't seem to really find what it does. Does it run npm rebuild --runtime=electron ... ?

BTW if not does electron-builder has a command or such to do the npm rebuild ? (something that needs to be done after a npm install for native modules to work.

Thanks

question

Most helpful comment

Does it run npm rebuild --runtime=electron ... ?

Yes. But! build from sources is not forced. If some of your native dep still use node-pre-gyp instead of prebuild, you have to set option "buildDependenciesFromSource": true and ask author of module to use prebuild (https://github.com/EmergingTechnologyAdvisors/node-serialport/issues/1180).

All 18 comments

In the readme:

To ensure your native dependencies are always matched electron version, simply add script "postinstall": "electron-builder install-app-deps" to your package.json.

Please note — it is optional command. In any case electron-builder will rebuild production native deps on build.

@develar sorry but that doc line does not explain it for me :s What does it do?
And i think i am right to ask because if install-app-deps is supposed to do the npm rebuild --runtime=electron ... then it does not work here for me on windows 10

Does it run npm rebuild --runtime=electron ... ?

Yes. But! build from sources is not forced. If some of your native dep still use node-pre-gyp instead of prebuild, you have to set option "buildDependenciesFromSource": true and ask author of module to use prebuild (https://github.com/EmergingTechnologyAdvisors/node-serialport/issues/1180).

@develar thanks a lot i now understand. I actually use serialport too, but the 4.0 so still using node-pre-gyp.
Too many modules use node-pre-gyp, will need buildDependenciesFromSource for some time...
Thanks

As stated, my decision violates this project rules... but it is better for users in the end. Thanks to @reconbot, serialport now uses prebuild. Please use [email protected]

@develar Yes i would but it also changes a lot of things. i have to test it all first.
Also my issue are now with:

  • node usb
  • node opencv
  • node noble
  • node noble-uwp
  • ....

Still a lot of them ;)

@farfromrefug So, someone should be a hero and report bug to node-pre-gyp — why fallback is not used when no compatible binary. prebuild in this case correctly fallback to build from sources. Why I don't report? Because node-pre-gyp is broken by design and it is better just use prebuild instead of fixing it.

As user, you can simply set buildDependenciesFromSource to true and forget.
if you want cross-platform build — well, file issues.

@develar I actually understand your point i am willing to migrate to prebuild.
I still have a lot of questions to solve about it (like generic publishing instead of github, multiple bindings naming (noble-uwp)).

As for node-pre-gyp issue, i am also ok with reporting it. First i have to really understand the issue. Will look deeply at the issue on serialport to understand it.

@develar and yes i want cross-platform builds! I don't do it now and native modules are the reason...

and yes i want cross-platform builds!

We are one step closer to this dream :) Thanks to electron-builder breaking change ;) Without forcing, this situation will be forever.

@develar and i found one another one : sqlite3. But this one is made by the same guys who made node-pre-gyp, might be harder to get them to switch ;)

@danielecr Yes, native module must use prebuild.

I have the same problem. I try to test https://github.com/skwid138/electron-create-react-app, and during the npm i or yarn, it always gave me 'install-app-deps' is not recognized as an internal or external command issue.

D:\code\electron\electron-create-react-app-master>yarn
yarn install v1.10.1
[1/4] Resolving packages...
[2/4] Fetching packages...
info [email protected]: The platform "win32" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Saved lockfile.
$ install-app-deps
'install-app-deps' is not recognized as an internal or external command,
operable program or batch file.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

D:\code\electron\electron-create-react-app-master>node -v
v11.0.0

D:\code\electron\electron-create-react-app-master>npm -v
6.4.1

D:\code\electron\electron-create-react-app-master>yarn -v
1.10.1

D:\code\electron\electron-create-react-app-master>

I'm using a number of native deps (node-hid, forcefocus, keytar, fsevents) I think all of those use prebuild EXCEPT fsevents and I am getting the following error when using install-app-deps. should I turn on the buildDependenciesFromSource flag to true?

image

Actually an update on my comment for those it may help:

  1. Switch back to using yarn. This helped.
  2. Using "postinstall": "electron-rebuild install-app-deps"
  3. Removing buildDependenciesFromSource from build config
  4. On Electron 4.0.4, Node 10.15.1, and with the following native deps
    i) forcefocus 1.0.0
    ii) keytar 4.4.0
    iii) fsevents 1.2.3

With this I can generate a windows build, on a mac

Was this page helpful?
0 / 5 - 0 ratings

Related issues

antonycourtney picture antonycourtney  Â·  3Comments

AidanNichol picture AidanNichol  Â·  3Comments

leo picture leo  Â·  3Comments

mstralka picture mstralka  Â·  3Comments

jhg picture jhg  Â·  3Comments