Cannot execute a vendored nodejs on Raspberry Pi 4 with NixOS

Hi all!

I am trying to run a vendored executable under NixOS on a Raspberry Pi 4. The executable is node (NodeJS) and I cannot replace it with the NodeJS from NixOS (it’s provided by Visual Studio Code; see context below).

Here’s what happens when I try to run the node executable:

$ ./node
zsh: no such file or directory: ./node

What I found so far:

I can confirm that the file exists and has the executable flag:

$ stat ./node
Access: (0555/-r-xr-xr-x)  Uid: ( 1001/     me)   Gid: (  100/   users)

I also found that the linker cannot find libstdc++:

$ ldd ./node | grep 'not found'
libstdc++.so.6 => not found

So, I tried to provide the library via LD_LIBRARY_PATH:

$ LD_LIBRARY_PATH=/nix/var/nix/profiles/system/sw/lib ldd ./node | grep 'not found'

The library was no longer missing, however, the error didn’t go away:

$ LD_LIBRARY_PATH=/nix/var/nix/profiles/system/sw/lib ./node
zsh: no such file or directory: ./node

Surprisingly, I found that I can actually run the executable like this:

$ LD_LIBRARY_PATH=/nix/var/nix/profiles/system/sw/lib /nix/store/6diwpjpcjz497wxwj4mdbfg8hl1hi8l2-glibc-2.32/lib/ld-linux-aarch64.so.1 ./node
Welcome to Node.js v12.14.1.
Type ".help" for more information.
>

Unfortunately, this solution does not solve my problem. I need a solution where this node binary is executable as is from the shell (without the weird ld-linux invocation).

Any suggestions on what can be done here would be super welcome :bowing_man:


Context: I am trying to use Visual Studio Code’s remote SSH feature to edit files on my Raspberry Pi 4 (running NixOS) remotely.

The Raspberry Pi runs NixOS (nixos-21.03pre254279.6f0c00907bb).

Repro steps: I run vscode on a Ubuntu machine. Then I tell vscode to connect to RPi. It successfully logs into the RPi via ssh and also successfully downloads its vendored aarch64 vscode-server distribution into the following folder:

~/.vscode-server/bin/e5a624b788d92b8d34d1392e4c4d9789406efe8f

However, vscode then tries to execute the node binary in that folder:

~/.vscode-server/bin/e5a624b788d92b8d34d1392e4c4d9789406efe8f/node

which results in a failure with the following message:

zsh: no such file or directory:~/.vscode-server/bin/e5a624b788d92b8d34d1392e4c4d9789406efe8f/node

Apologies for the length and thank you in advance for all your help!

Cheers!

1 Like