'NixOs: Can’t setup development with electron: Error: spawn ENOENT
I need to create a project involving electron and some libraries (easymidi), but I can't find how to do:
- If I install electron from Nix directly, for instance using
nix-shell -p electron_17, I can start a basic hello world project, but then I can't import other node libraries (if I install them withyarn, I get an error about unknown symbols, I guess becauseyarnand the nixelectronruns different nodejs version - If I do everything using yarn or npm, electron can't even start a basic hello world folder:
$ 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.
Any idea what I did wrong? How can I setup electron with some random libraries like easymidi?
EDIT
Here is the log file (tried the same with npm, same error):
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 [email protected]
3 info using [email protected]
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle [email protected]~prestart: [email protected]
6 info lifecycle [email protected]~start: [email protected]
7 verbose lifecycle [email protected]~start: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]~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 [email protected]~start: CWD: /tmp/d/electron-quick-start
10 silly lifecycle [email protected]~start: Args: [ '-c', 'electron .' ]
11 silly lifecycle [email protected]~start: Returned: code: 1 signal: null
12 info lifecycle [email protected]~start: Failed to exec start script
13 verbose stack Error: [email protected] 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 [email protected]
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 [email protected] start: `electron .`
22 error Exit status 1
23 error Failed at the [email protected] start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
EDIT
I also tried npm2nix-like tools, but they also failed.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
