I need to use both electron and some node libraries (easymidi). If I install directly the electron package, I can start directly the project, but then I can't install/use node libraries (or at least I don't know how). If I use npm, yarn or node2nix to install electron, then I get errors (as I reported here), given in the steps to reproduce.
Steps To Reproduce
Steps to reproduce the behavior:
$ nix-shell -p yarn
$ git clone https://github.com/electron/electron-quick-start
$ cd electron-quick-start/
$ yarn install
$ yarn start
yarn run v1.22.15
$ electron .
events.js:377
throw er; // Unhandled 'error' event
^
Error: spawn /tmp/c/electron-quick-start/node_modules/electron/dist/electron ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:274:19)
at onErrorNT (internal/child_process.js:469:16)
at processTicksAndRejections (internal/process/task_queues.js:82:21)
Emitted 'error' event on ChildProcess instance at:
at Process.ChildProcess._handle.onexit (internal/child_process.js:280:12)
at onErrorNT (internal/child_process.js:469:16)
at processTicksAndRejections (internal/process/task_queues.js:82:21) {
errno: -2,
code: 'ENOENT',
syscall: 'spawn /tmp/c/electron-quick-start/node_modules/electron/dist/electron',
path: '/tmp/c/electron-quick-start/node_modules/electron/dist/electron',
spawnargs: [ '.' ]
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Here are the detailled log (produced with a different run with the same error, using npm here):
0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli '/nix/store/06680csx89n416lvsy2yljmw6rvibj8y-nodejs-14.18.0/bin/node',
1 verbose cli '/nix/store/06680csx89n416lvsy2yljmw6rvibj8y-nodejs-14.18.0/bin/npm',
1 verbose cli 'start'
1 verbose cli ]
2 info using npm@6.14.15
3 info using node@v14.18.0
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle electron-quick-start@1.0.0~prestart: electron-quick-start@1.0.0
6 info lifecycle electron-quick-start@1.0.0~start: electron-quick-start@1.0.0
7 verbose lifecycle electron-quick-start@1.0.0~start: unsafe-perm in lifecycle true
8 verbose lifecycle electron-quick-start@1.0.0~start: PATH: /nix/store/06680csx89n416lvsy2yljmw6rvibj8y-nodejs-14.18.0/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/tmp/d/electron-quick-start/no
de_modules/.bin:/nix/store/yx24h6ywbkg7rm5x7lrm8mx8ypcf4ywi-bash-interactive-5.1-p8/bin:/nix/store/fj3ywsx22xvjd4mly4323ikjcavyv91v-patchelf-0.13/bin:/nix/store/s5hkav7whndbfz0szshpb46h4idqdq9a-gcc-wrapper-10.3
.0/bin:/nix/store/a2w3l1m75908yd05a0h40vnrzvxfd0gd-gcc-10.3.0/bin:/nix/store/mfz26azl9561jgd5n73nkszzp6qhsaal-glibc-2.33-50-bin/bin:/nix/store/xyn0240zrpprnspg3n0fi8c8aw5bq0mr-coreutils-8.32/bin:/nix/store/5d5j
1z9bg01wqxahihy2x5n22ykc32w8-binutils-wrapper-2.35.1/bin:/nix/store/a4mmjm3bblxwp8h53bcfx3dly80ib0ba-binutils-2.35.1/bin:/nix/store/06680csx89n416lvsy2yljmw6rvibj8y-nodejs-14.18.0/bin:/nix/store/xyn0240zrpprnsp
g3n0fi8c8aw5bq0mr-coreutils-8.32/bin:/nix/store/1nq62klcc9n2jv2ixaf77makkzdcghrh-findutils-4.8.0/bin:/nix/store/xwkxkx4bk005q35hsdhqbkbdv7g28cz5-diffutils-3.8/bin:/nix/store/dy4ylp9439la4lq35ah2mj80fi87pk4w-gnu
sed-4.8/bin:/nix/store/xxgddhdi57bbgd1yxza44plq6krjmiz1-gnugrep-3.6/bin:/nix/store/31pkw5yi08fj4l0glzvpf1cp4ywkxh86-gawk-5.1.0/bin:/nix/store/nwg8in201f7y6vdm787v3j84jjrn0ayw-gnutar-1.34/bin:/nix/store/ygzg6wzh
gxf51ianb4zjvrzq4ilx9jd7-gzip-1.10/bin:/nix/store/gakfgapj20lv13vkcz6c38j8i9vz4ypi-bzip2-1.0.6.0.2-bin/bin:/nix/store/xgp0bgw4rpnbc3vr2qdsdbixp3zy4v1l-gnumake-4.3/bin:/nix/store/wadmyilr414n7bimxysbny876i2vlm5r
-bash-5.1-p8/bin:/nix/store/347zp4r9a7gm5gk0gwijqw294nnyypcs-patch-2.7.6/bin:/nix/store/f2x98vk07px8916b9xid7jq6ky86sfmi-xz-5.2.5-bin/bin
9 verbose lifecycle electron-quick-start@1.0.0~start: CWD: /tmp/d/electron-quick-start
10 silly lifecycle electron-quick-start@1.0.0~start: Args: [ '-c', 'electron .' ]
11 silly lifecycle electron-quick-start@1.0.0~start: Returned: code: 1 signal: null
12 info lifecycle electron-quick-start@1.0.0~start: Failed to exec start script
13 verbose stack Error: electron-quick-start@1.0.0 start: `electron .`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (/nix/store/06680csx89n416lvsy2yljmw6rvibj8y-nodejs-14.18.0/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
13 verbose stack at EventEmitter.emit (events.js:400:28)
13 verbose stack at ChildProcess.<anonymous> (/nix/store/06680csx89n416lvsy2yljmw6rvibj8y-nodejs-14.18.0/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:400:28)
13 verbose stack at maybeClose (internal/child_process.js:1058:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:293:5)
14 verbose pkgid electron-quick-start@1.0.0
15 verbose cwd /tmp/d/electron-quick-start
16 verbose Linux 5.10.75
17 verbose argv "/nix/store/06680csx89n416lvsy2yljmw6rvibj8y-nodejs-14.18.0/bin/node" "/nix/store/06680csx89n416lvsy2yljmw6rvibj8y-nodejs-14.18.0/bin/npm" "start"
18 verbose node v14.18.0
19 verbose npm v6.14.15
20 error code ELIFECYCLE
21 error errno 1
22 error electron-quick-start@1.0.0 start: `electron .`
22 error Exit status 1
23 error Failed at the electron-quick-start@1.0.0 start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
If I try to use node2nix (after removing the node_modules as it gives errors), I can't even install the libraries:
$ nix-shell -I nixpkgs=local-nixos-unstable -A shell
[...]
> electron@18.0.2 postinstall /nix/store/rz9jlhkzwgy1xv0ky35ww1zdqb28f0zx-node-dependencies-electron-quick-start-1.0.0/electron-quick-start/node_modules/electron
> node install.js
RequestError: getaddrinfo ENOTFOUND github.com
at ClientRequest.<anonymous> (/nix/store/rz9jlhkzwgy1xv0ky35ww1zdqb28f0zx-node-dependencies-electron-quick-start-1.0.0/electron-quick-start/node_modules/got/source/request-as-event-emitter.js:178:14)
at Object.onceWrapper (events.js:421:26)
at ClientRequest.emit (events.js:326:22)
at ClientRequest.origin.emit (/nix/store/rz9jlhkzwgy1xv0ky35ww1zdqb28f0zx-node-dependencies-electron-quick-start-1.0.0/electron-quick-start/node_modules/@szmarczak/http-timer/source/index.js:37:11)
at TLSSocket.socketErrorListener (_http_client.js:427:9)
at TLSSocket.emit (events.js:314:20)
at emitErrorNT (internal/streams/destroy.js:92:8)
at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! electron@18.0.2 postinstall: `node install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the electron@18.0.2 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /build/.npm/_logs/2022-04-06T08_02_33_311Z-debug.log
error: builder for '/nix/store/xzifn0013kxmv2kdck7n5m8422ppad78-node-dependencies-electron-quick-start-1.0.0.drv' failed with exit code 1;
last 10 log lines:
> npm ERR! errno 1
> npm ERR! electron@18.0.2 postinstall: `node install.js`
> npm ERR! Exit status 1
> npm ERR!
> npm ERR! Failed at the electron@18.0.2 postinstall script.
> npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
>
> npm ERR! A complete log of this run can be found in:
> npm ERR! /build/.npm/_logs/2022-04-06T08_02_33_311Z-debug.log
>
For full logs, run 'nix log /nix/store/xzifn0013kxmv2kdck7n5m8422ppad78-node-dependencies-electron-quick-start-1.0.0.drv'.
Note that to ensure I was running the latest version, I also tried to use nix-shell -I nixpkgs=local-nixos-unstable instead of nix-shell, with the same errors.
I got the same getaddrinfo ENOTFOUND github.com error in my buildNpmPackage-based expression, and setting ELECTRON_SKIP_BINARY_DOWNLOAD=1 (example) allows the build to proceed.
Describe the bug
I need to use both electron and some node libraries (easymidi). If I install directly the electron package, I can start directly the project, but then I can't install/use node libraries (or at least I don't know how). If I use npm, yarn or node2nix to install electron, then I get errors (as I reported here), given in the steps to reproduce.
Steps To Reproduce
Steps to reproduce the behavior:
Here are the detailled log (produced with a different run with the same error, using npm here):
If I try to use
node2nix
(after removing thenode_modules
as it gives errors), I can't even install the libraries:The closer issue I can find is this one https://github.com/electron-userland/electron-builder/issues/6069 but the solution does not seem to work for me.
Expected behavior
I expect to be able to develop electron apps using yarn, npm or node2nix.
Notify maintainers
@svanderburg @goibhniu @gilligan @cko @marsam @travisbhartwell @manveru @prusnak
Metadata
Please run
nix-shell -p nix-info --run "nix-info -m"
and paste the result."x86_64-linux"
Linux 5.10.75, NixOS, 21.11 (Porcupine)
yes
yes
nix-env (Nix) 2.5pre20211007_844dd90
"local-nixos-unstable-22.05pre366144.bc4b9eef3ce, nixos-unstable-22.05pre362644.1ec61dd4167, home-manager, local-nixpkgs-unstable-21.11pre304920.dd98b100651, nixos-20-03-20.03.3328.6d1a044fc9f, test"
"nixos-21.11pre325514.a4bf4434570"
/nix/var/nix/profiles/per-user/root/channels/nixos
Note that to ensure I was running the latest version, I also tried to use
nix-shell -I nixpkgs=local-nixos-unstable
instead ofnix-shell
, with the same errors.