nvm
nvm copied to clipboard
Node directory not found
Operating system and version:
Android 10
nvm debug output:
nvm --version: v0.38.0 $SHELL: /data/data/com.termux/files/usr/bin/bash $SHLVL: 1 whoami: 'u0_a266' ${HOME}: /data/data/com.termux/files/home ${NVM_DIR}: '${HOME}/.nvm' ${PATH}: ${NVM_DIR}/versions/node/v16.6.2/bin:/data/data/com.termux/files/usr/bin:/data/data/com.termux/files/usr/bin/applets $PREFIX: '' ${NPM_CONFIG_PREFIX}: '' $NVM_NODEJS_ORG_MIRROR: '' $NVM_IOJS_ORG_MIRROR: '' shell version: 'GNU bash, version 5.0.18(1)-release (aarch64-unknown-linux-android)' uname -a: 'Linux 4.19.95-perf+ #1 SMP PREEMPT Sun May 2 05:51:13 CDT 2021 aarch64 Android' checksum binary: 'sha256sum' curl: /data/data/com.termux/files/usr/bin/curl, curl 7.72.0 (aarch64-unknown-linux-android) libcurl/7.72.0 OpenSSL/1.1.1h zlib/1.2.11 libssh2/1.9.0 nghttp2/1.41.0wget: /data/data/com.termux/files/usr/bin/wget, GNU Wget 1.21.1 built on linux-android. git: /data/data/com.termux/files/usr/bin/git, git version 2.32.0 grep: /data/data/com.termux/files/usr/bin/grep, grep (GNU grep) 3.4 awk: /data/data/com.termux/files/usr/bin/awk, GNU Awk 5.1.0, API: 3.0 (GNU MPFR 4.1.0, GNU MP 6.2.0) sed: /data/data/com.termux/files/usr/bin/sed, sed (GNU sed) 4.8 cut: /data/data/com.termux/files/usr/bin/cut, cut (GNU coreutils) 8.32 basename: /data/data/com.termux/files/usr/bin/basename, basename (GNU coreutils) 8.32
rm: /data/data/com.termux/files/usr/bin/rm, rm (GNU coreutils) 8.32 mkdir: /data/data/com.termux/files/usr/bin/mkdir, mkdir (GNU coreutils) 8.32 xargs: /data/data/com.termux/files/usr/bin/xargs, xargs (GNU findutils) 4.7.0 nvm current: which node: ${NVM_DIR}/versions/node/v16.6.2/bin/node which iojs:
which npm: ${NVM_DIR}/versions/node/v16.6.2/bin/npm npm config get prefix: /data/data/com.termux/files/usrnpm root -g: /data/data/com.termux/files/usr/lib/node_modules
bash: /data/data/com.termux/files/home/.nvm/versions/node/v16.6.2/bin/node: No such file or directory
nvm ls output:
nvm ls v16.6.0 * v16.6.2 * system * default -> 16.6.0 (-> v16.6.0 *) iojs -> N/A (default)
How did you install nvm?
Install script in readme
What steps did you perform?
nvm install node nvm use node
What happened?
bash: /data/data/com.termux/files/home/.nvm/versions/node/v16.6.2/bin/node: No such file or directory
What did you expect to happen?
Start using node v16.6.2?
Is there anything in any of your profile files that modifies the PATH?
No
The nvm debug and ls output seems to be missing a lot of newlines - any chance you could try to copy and paste it again?
The nvm debug and ls output seems to be missing a lot of newlines - any chance you could try to copy and paste it again?
$ nvm debug nvm --version: v0.38.0 $SHELL: /data/data/com.termux/files/usr/bin/bash
$SHLVL: 1 whoami: 'u0_a152'
${HOME}: /data/data/com.termux/files/home ${NVM_DIR}: '${HOME}/.nvm' ${PATH}: ${NVM_DIR}/versions/node/v16.6.2/bin:/data/data/com.termux/files/usr/bin:/data/data/com.termux/files/usr/bin/applets $PREFIX: '' ${NPM_CONFIG_PREFIX}: ''
$NVM_NODEJS_ORG_MIRROR: '' $NVM_IOJS_ORG_MIRROR: ''
shell version: 'GNU bash, version 5.1.8(1)-release (aarch64-unknown-linux-android)'
uname -a: 'Linux 4.9.186-perf-18312766 #1 SMP PREEMPT Mon Jun 15 21:24:59 KST 2020 aarch64 Android' checksum binary: 'sha256sum'
curl: /data/data/com.termux/files/usr/bin/curl, curl 7.78.0 (aarch64-unknown-linux-android) libcurl/7.78.0 OpenSSL/1.1.1k zlib/1.2.11 libssh2/1.9.0 nghttp2/1.44.0 wget: /data/data/com.termux/files/usr/bin/wget, GNU Wget 1.21.1 built on linux-android.
git: /data/data/com.termux/files/usr/bin/git, git version 2.32.0grep: /data/data/com.termux/files/usr/bin/grep, grep (GNU grep) 3.6
awk: /data/data/com.termux/files/usr/bin/awk, GNU Awk 5.1.0, API: 3.0 (GNU MPFR 4.1.0, GNU MP 6.2.1)
sed: /data/data/com.termux/files/usr/bin/sed, sed (GNU sed) 4.8 cut: /data/data/com.termux/files/usr/bin/cut, cut (GNU coreutils) 8.32 basename: /data/data/com.termux/files/usr/bin/basename, basename (GNU coreutils) 8.32
rm: /data/data/com.termux/files/usr/bin/rm, rm (GNU coreutils) 8.32 mkdir: /data/data/com.termux/files/usr/bin/mkdir, mkdir (GNU coreutils) 8.32 xargs: /data/data/com.termux/files/usr/bin/xargs, xargs (GNU findutils) 4.8.0
nvm current: which node: ${NVM_DIR}/versions/node/v16.6.2/bin/node which iojs: which npm: ${NVM_DIR}/versions/node/v16.6.2/bin/npm
npm config get prefix: /data/data/com.termux/files/usr npm root -g: /data/data/com.termux/files/usr/lib/node_modules
hmm, that still doesn't look formatted correctly :-/ however, i note that npm root -g and npm config get prefix doesn't resolve to something inside $NVM_DIR - any idea what would be setting that? What does nvm_die_on_prefix tell you?
Same issue. Tried on Termux v0.117 (Android 9) and v0.83 (Android 6). Appears after successfully installing node, tried on v14.17.6 or v12.22.6.
Running 'node' or 'npm' commands throws an error 'No such file or directory' for that command file. Files exist in that path.
Example error running 'node':
$ node
-bash: /data/data/com.termux/files/home/.nvm/versions/node/v14.17.6/bin/node: No such file or directory
Operating system and version: Android 9 and Android 6
@koenigstag i believe termux uses a PREFIX env var which makes it incompatible with nvm (and interferes with the operation of npm itself, as well).
I'm running into the same issue on Termux. So do you mean it's a problem with for example hardcoded library paths within the node binary?
For reference, here's the difference between ldd on the system node and the one nvm downloaded (both are the same version):
$ ldd system-node
libdl.so
libz.so.1
libcares.so
libcrypto.so.1.1
libssl.so.1.1
libicui18n.so.70
libicuuc.so.70
libm.so
libc++_shared.so
libc.so
$ ldd nvm-node
libdl.so.2
libstdc++.so.6
libm.so.6
libgcc_s.so.1
libpthread.so.0
libc.so.6
ld-linux-aarch64.so
Also, the output of strace:
$ strace ./nvm-node
strace ./nvm-node
execve("./nvm-node", ["./nvm-node"], 0x7fdfe5d0c0 /* 38 vars */) = -1 ENOENT (No such file or directory)
strace: exec: No such file or directory
+++ exited with 1 +++
what is nvm-node?
I just did the following:
$ nvm use v17.1.0
Now using node v17.1.0 (npm v8.1.2)
$ which node
/data/data/com.termux/files/home/.nvm/versions/node/v17.1.0/bin/node
$ cp $(which node) nvm-node
Note that in general I also did unset PREFIX to allow nvm to work.
i am very very skeptical that will work; many things rely on the binary being named node.
Indeed, because termux uses PREFIX, termux is incompatible with nvm, and somewhat incompatible with npm as well.
I don't think this has any relationship to compiled binaries or shared libraries, though. How did you install your system node?
Finally, Termux team updated apt repositories in latest release, and there is an option to install nodejs-lts v16 using apt.
Just to clarify, the copying of node to nvm-node didn't change any behavior. I get the same results operating directly on the binary in its original location:
$ strace /data/data/com.termux/files/home/.nvm/versions/node/v17.1.0/bin/node --version
execve("/data/data/com.termux/files/home/.nvm/versions/node/v17.1.0/bin/node", ["/data/data/com.termux/files/home"..., "--version"], 0x7fe27edbb8 /* 35 vars */) = -1 ENOENT (No such file or directory)
strace: exec: No such file or directory
+++ exited with 1 +++
$ du /data/data/com.termux/files/home/.nvm/versions/node/v17.1.0/bin/node
78404 /data/data/com.termux/files/home/.nvm/versions/node/v17.1.0/bin/node
$ readlink /data/data/com.termux/files/home/.nvm/versions/node/v17.1.0/bin/node
$ strace /data/data/com.termux/files/usr/bin/node --version
execve("/data/data/com.termux/files/usr/bin/node", ["/data/data/com.termux/files/usr/"..., "--version"], 0x7fde87b7a8 /* 32 vars */) = 0
getpid() = 4648
mmap(NULL, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7485e5c000
...
exit_group(0) = ?
+++ exited with 0 +++
$ du /data/data/com.termux/files/usr/bin/node
27980 /data/data/com.termux/files/usr/bin/node
$ readlink /data/data/com.termux/files/usr/bin/node
You can see it fails immediately on the execve call. The system node at /data/data/com.termux/files/usr/bin/node is installed via pkg install node and compiled like this.
@koenigstag node should never be installed using apt, no matter the repo.
Here's a case where running 32 bit executables on a 64 bit system cause a similar error.
I'm curious, from nvm's side, what architecture is the binaries that are downloaded and how are they built? (assuming this question even makes sense; I'm super unfamiliar with node/nvm).
My current hunch is either that the binary is the wrong architecture (ie. 32 bit vs 64 bit) binary or some missing symbols/libraries possibly due to the weird prefix, although I assumed if it were the latter the error would be with dlopen.
@MatthewScholefield nvm selects from one of the available binaries (that logic could always potentially be improved, of course), and falls back to node’s build process, occasionally prepopulating some of the CXX and adjacent variables. That’s really about it; if something doesn’t build right it’s either that nvm can provide build args to fix it, or, node itself has the problem.