0

After installing n to manage node versions on my alpine vm, I am having the following issue where the node executable is not found, despite existing

    vscode ➜ /workspaces/tom $ which node -a
    /usr/local/bin/node
    /usr/bin/node
    vscode ➜ /workspaces/tom $ which node
    /usr/local/bin/node
    vscode ➜ /workspaces/tom $ node -v
    bash: /usr/local/bin/node: No such file or directory
    vscode ➜ /workspaces/tom $ pushd /usr/local/bin
    /usr/local/bin /workspaces/tom
    vscode ➜ /usr/local/bin $ ls -la node
    -rwxr-xr-x 1 root root 90940576 Apr 26 12:35 node
    vscode ➜ /usr/local/bin $ popd
    /workspaces/tom
    vscode ➜ /workspaces/tom $ node -v
    bash: /usr/local/bin/node: No such file or directory
    vscode ➜ /workspaces/tom $ sudo node -v
    sudo: unable to execute /usr/local/bin/node: No such file or directory

The file exists, which can find it, it has read and execute permissions, but when trying to execute it, it is found at its location and then reported as being none such file or directory.

What is going on?

  • 1
    Please verify that the executable file has the correct architecture for you system - see for example "No such file or directory" lies on Optware installed binaries – steeldriver Apr 26 '23 at 13:32
  • 1
    If the linked answers don’t explain this, please let me know and I’ll re-open this. – Stephen Kitt Apr 26 '23 at 13:37
  • @StephenKitt after apk adding file, I'm seeing:

    node: ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2

    and

    getconf LONG_BIT gives me 64

    However it appears to be an issue with Error loading shared library ld-linux-x86-64.so.2: No such file or directory (needed by /usr/local/bin/node)

    – StuperUser Apr 26 '23 at 13:39
  • 1
    Right, that’s exactly what the linked Q&A explains: you’re trying to run a glibc binary on a musl-based system (Alpine). You should try using Alpine’s own Node package: apk add nodejs-current. – Stephen Kitt Apr 26 '23 at 13:42
  • 1
    You can also try the workaround given in the second linked answer: /lib/ld-musl-x86_64.so.1 /usr/local/bin/node. – Stephen Kitt Apr 26 '23 at 13:50

0 Answers0