`node` installed via home-manager fails on WSL

I have nodejs installed via home-manager, under home.packages. This works great on my linux laptop, however when I try to run node on my desktop under WSL I get the following:

⮞ node
exec: Failed to execute process: '/home/james/.nix-profile/bin/node' the file could not be run by the operating system.

⮞ file (readlink (readlink (which node)))
/nix/store/4yaxl9p8ifalfzggxm59gmvwjd6w7sw0-nodejs-16.15.0/bin/node: ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /nix/store/k56d9sk88pvrqhvwpa6msdf8gpwnimf6-glibc-2.34-210/lib/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, not stripped

Any idea what could be causing this?

1 Like

I found this issue on WSL, so it may turn out to be unrelated to Nix

Edit: nope, it turns out it works fine when installed from nvm

Whats the output of ldd and do all the libraries exist? What is the output of strace?

⮞ ldd (realpath (which node)) | cut -d ' ' -f 3 | xargs realpath | xargs file
/nix/store/z18zgvspmxi88ipmk3f3nicvasfq3199-zlib-1.2.12/lib/libz.so.1.2.12:         ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, not stripped
/nix/store/bcf65vv2lr5swahbn65c7jnixl9ipyyf-libuv-1.44.2/lib/libuv.so.1.0.0:        ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, not stripped
/nix/store/sxgs416j8z3x9mj97939syyp8cv6064b-openssl-1.1.1q/lib/libcrypto.so.1.1:    ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=8a831fbeb38ba6ac8d310e51bed2031840039e44, not stripped
/nix/store/sxgs416j8z3x9mj97939syyp8cv6064b-openssl-1.1.1q/lib/libssl.so.1.1:       ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=c48e0b92e05b5d092872fafd275b917adb9efebd, not stripped
/nix/store/ryp3317pxkpw3vrb8l9ynf6fxa1b462p-icu4c-71.1/lib/libicui18n.so.71.1:      ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, not stripped
/nix/store/ryp3317pxkpw3vrb8l9ynf6fxa1b462p-icu4c-71.1/lib/libicuuc.so.71.1:        ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, not stripped
/nix/store/ryp3317pxkpw3vrb8l9ynf6fxa1b462p-icu4c-71.1/lib/libicudata.so.71.1:      ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, not stripped
/nix/store/7fz6dhhriwv6n4kdg05qi8cwf7mfqza9-glibc-2.35-163/lib/libdl.so.2:          ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=e24fc32b3f8cf5d7529a7593115ddf69ea879812, for GNU/Linux 2.6.32, not stripped
/nix/store/k2a429wpxgfwp4jaacl9iaqw4kxqjaxa-gcc-11.3.0-lib/lib/libstdc++.so.6.0.29: ELF 64-bit LSB shared object, x86-64, version 1 (GNU/Linux), dynamically linked, with debug_info, not stripped
/nix/store/7fz6dhhriwv6n4kdg05qi8cwf7mfqza9-glibc-2.35-163/lib/libm.so.6:           ELF 64-bit LSB shared object, x86-64, version 1 (GNU/Linux), dynamically linked, BuildID[sha1]=f158848ecd632c4bedb4dc6389a7d6e889914422, for GNU/Linux 2.6.32, not stripped
/nix/store/7fz6dhhriwv6n4kdg05qi8cwf7mfqza9-glibc-2.35-163/lib/libgcc_s.so.1:       ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, not stripped
/nix/store/7fz6dhhriwv6n4kdg05qi8cwf7mfqza9-glibc-2.35-163/lib/libpthread.so.0:     ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=b59e50cf021fdc872dc49d194c9594fe7ba48906, for GNU/Linux 2.6.32, not stripped
/nix/store/7fz6dhhriwv6n4kdg05qi8cwf7mfqza9-glibc-2.35-163/lib/libc.so.6:           ELF 64-bit LSB shared object, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /nix/store/7fz6dhhriwv6n4kdg05qi8cwf7mfqza9-glibc-2.35-163/lib/ld-linux-x86-64.so.2, BuildID[sha1]=ea820e0850adf983a2ea0bd0002e33f891cbd95d, for GNU/Linux 2.6.32, not stripped
/usr/lib/x86_64-linux-gnu/ld-2.31.so:                                               ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=5374b5558386b815e69cc1838a6052cc9b4746f3, stripped
⮞ strace node
execve("/home/james/.nix-profile/bin/node", ["node"], 0x7fffcb7f4860 /* 27 vars */) = -1 ENOEXEC (Exec format error)
strace: exec: Exec format error
+++ exited with 1 +++

Do any 64 bit binaries work? Are you on aarch64 somehow? Have some kind of 32 bit emulation turned on on accident?

This one’s delightfully bizzare! Maybe check if the store path has been corrupted somehow: nix store verify

that is not the nix ld that is being used. Do you have LD_LIBRARY_PATH set?

Hosted by Flying Circus.