nvm
nvm copied to clipboard
nvm ls hangs at time or gets into a weird state
On Linux:
When I do nvm ls, it will hang or never return to a terminal prompt and will keep printing "$" but not allow command to be entered.
In video I am unble to type anything once the terminal prompt "$", what you see is my hitting "enter" key multiple times to get out of this state. Press CTRL+C doesn't help.
Video: https://youtu.be/FxAQcqmjya4
Operating system and version:
Operating System: openSUSE Tumbleweed 20240121
nvm debug output:
$ nvm debug
nvm --version: v0.39.7
$SHELL: /bin/bash
$SHLVL: 1
whoami: 'yadav'
${HOME}: /home/yadav
${NVM_DIR}: '${HOME}/.nvm'
${PATH}: ${HOME}/.sdkman/candidates/java/current/bin:${NVM_DIR}/versions/node/v18.19.0/bin:${HOME}/.cabal/bin:${HOME}/.ghcup/bin:${HOME}/.yarn/bin:/opt/local/apps/tfenv/bin/:${HOME}/.local/bin:/usr/local/bin:/usr/bin:/bin:/snap/bin:${HOME}/.sdkman/candidates/maven/current/bin:${HOME}/.sdkman/candidates/gradle/current/bin:/opt/local/apps/go/bin:/home/TT1TB/dev2/Android/cmdline-tools/latest/bin:/home/TT1TB/dev2/Android/platform-tools:/home/TT1TB/dev2/Android/emulator:${HOME}/Android/Sdk/build-tools/34.0.0:${HOME}/.local/bin:/opt/local/apps/youtube-dl/:/opt/local/apps/:/opt/local/apps/idea-IC-223.8214.52/bin/
$PREFIX: ''
${NPM_CONFIG_PREFIX}: ''
$NVM_NODEJS_ORG_MIRROR: ''
$NVM_IOJS_ORG_MIRROR: ''
shell version: 'GNU bash, version 5.2.26(1)-release (x86_64-suse-linux)'
uname -a: 'Linux 6.6.11-1-default #1 SMP PREEMPT_DYNAMIC Thu Jan 11 08:01:39 UTC 2024 (05ae4ad) x86_64 x86_64 x86_64 GNU/Linux'
checksum binary: 'sha256sum'
OS version: Welcome to openSUSE Tumbleweed 20240121 - Kernel ().
awk: /usr/bin/awk, GNU Awk 5.3.0, API 4.0, PMA Avon 8-g1, (GNU MPFR 4.2.1, GNU MP 6.3.0)
curl: /usr/bin/curl, curl 8.5.0 (x86_64-suse-linux-gnu) libcurl/8.5.0 OpenSSL/3.1.4 zlib/1.3 brotli/1.1.0 zstd/1.5.5 libidn2/2.3.4 libpsl/0.21.2 (+libidn2/2.3.4) libssh/0.10.5/openssl/zlib nghttp2/1.58.0 OpenLDAP/2.6.6
wget: /usr/bin/wget, GNU Wget 1.21.4 built on linux-gnu.
git: /usr/bin/git, git version 2.43.0
grep: /usr/bin/grep (grep --color=auto), grep (GNU grep) 3.11
sed: /usr/bin/sed, sed (GNU sed) 4.9
cut: /usr/bin/cut, cut (GNU coreutils) 9.4
basename: /usr/bin/basename, basename (GNU coreutils) 9.4
rm: /usr/bin/rm (rm -i), rm (GNU coreutils) 9.4
mkdir: /usr/bin/mkdir, mkdir (GNU coreutils) 9.4
xargs: /usr/bin/xargs, xargs (GNU findutils) 4.9.0
nvm current: v18.19.0
which node: ${NVM_DIR}/versions/node/v18.19.0/bin/node
which iojs: which: no iojs in (${HOME}/.sdkman/candidates/java/current/bin:${NVM_DIR}/versions/node/v18.19.0/bin:${HOME}/.cabal/bin:${HOME}/.ghcup/bin:${HOME}/.yarn/bin:/opt/local/apps/tfenv/bin/:${HOME}/.local/bin:/usr/local/bin:/usr/bin:/bin:/snap/bin:${HOME}/.sdkman/candidates/maven/current/bin:${HOME}/.sdkman/candidates/gradle/current/bin:/opt/local/apps/go/bin:/home/TT1TB/dev2/Android/cmdline-tools/latest/bin:/home/TT1TB/dev2/Android/platform-tools:/home/TT1TB/dev2/Android/emulator:${HOME}/Android/Sdk/build-tools/34.0.0:${HOME}/.local/bin:/opt/local/apps/youtube-dl/:/opt/local/apps/:/opt/local/apps/idea-IC-223.8214.52/bin/)
which npm: ${NVM_DIR}/versions/node/v18.19.0/bin/npm
npm config get prefix: ${NVM_DIR}/versions/node/v18.19.0
npm root -g: ${NVM_DIR}/versions/node/v18.19.0/lib/node_modules
nvm ls output:
$ $ $ $ $ $
How did you install nvm?
readme install script
What steps did you perform?
typed nvm ls
What happened?
hangs as time, other times only prints "$" (prompt) but I cannot type. Pressing CTRL+C doesn't help.
What did you expect to happen?
execute the command correctly.
Is there anything in any of your profile files that modifies the PATH?
YES, but in the past nvm worked fined and nothing was changed in defined path.
If you are having installation issues, or getting "N/A", what does curl -I --compressed -v https://nodejs.org/dist/ print out?
Thanks for the report! I’ll take a more thorough look later this week when I’m done traveling, but in the meantime, what does nvm_ls do?
If that hangs too, can you run set +x ; nvm_ls too?
No hanging with nvm_ls.
$ nvm_ls
v18.19.0
v20.10.0
v20.11.0
This has been a problem for a long while, I finally got annoyed to file a report.
I guess same set x question for nvm ls then - I’d only need the last 5-10 lines of output (hanging implies an infinite loop)
You can see the output in the video like in original post. Here is the exact output I get with the spacing. It seems to complete, but then I am unable to use terminal and need to close it.
$ nvm ls
-> v18.19.0
v20.10.0
v20.11.0
default -> lts/hydrogen (-> v18.19.0)
iojs -> N/A (default)
unstable -> N/A (default)
node -> stable (-> v20.11.0) (default)
stable -> 20.11 (-> v20.11.0) (default)
lts/* -> lts/iron (-> v20.11.0)
lts/argon -> v4.9.1 (-> N/A)
lts/boron -> v6.17.1 (-> N/A)
lts/carbon -> v8.17.0 (-> N/A)
lts/dubnium -> v10.24.1 (-> N/A)
lts/erbium -> v12.22.12 (-> N/A)
lts/fermium -> v14.21.3 (-> N/A)
lts/gallium -> v16.20.2 (-> N/A)
lts/hydrogen -> v18.19.0
lts/iron -> v20.11.0
I notice in the video that the first l in lts/* is cut off, and the gap appears where the iojs stuff is supposed to appear. Can you try curl -I --compressed -v https://iojs.org/dist/ ?
$ curl -I --compressed -v https://iojs.org/dist/
* Host iojs.org:443 was resolved.
* IPv6: 2606:4700:130:436c:6f75:6466:6c61:7265
* IPv4: 172.64.80.1
* Trying [2606:4700:130:436c:6f75:6466:6c61:7265]:443...
* Connected to iojs.org (2606:4700:130:436c:6f75:6466:6c61:7265) port 443
* ALPN: curl offers h2,http/1.1
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.3 (IN), TLS handshake, Encrypted Extensions (8):
* TLSv1.3 (IN), TLS handshake, Certificate (11):
* TLSv1.3 (IN), TLS handshake, CERT verify (15):
* TLSv1.3 (IN), TLS handshake, Finished (20):
* TLSv1.3 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.3 (OUT), TLS handshake, Finished (20):
* SSL connection using TLSv1.3 / TLS_AES_256_GCM_SHA384 / X25519 / id-ecPublicKey
* ALPN: server accepted h2
* Server certificate:
* subject: CN=iojs.org
* start date: Dec 26 05:10:54 2023 GMT
* expire date: Mar 25 05:10:53 2024 GMT
* subjectAltName: host "iojs.org" matched cert's "iojs.org"
* issuer: C=US; O=Let's Encrypt; CN=E1
* SSL certificate verify ok.
* Certificate level 0: Public key type EC/prime256v1 (256/128 Bits/secBits), signed using ecdsa-with-SHA384
* Certificate level 1: Public key type EC/secp384r1 (384/192 Bits/secBits), signed using ecdsa-with-SHA384
* Certificate level 2: Public key type EC/secp384r1 (384/192 Bits/secBits), signed using ecdsa-with-SHA384
* using HTTP/2
* [HTTP/2] [1] OPENED stream for https://iojs.org/dist/
* [HTTP/2] [1] [:method: HEAD]
* [HTTP/2] [1] [:scheme: https]
* [HTTP/2] [1] [:authority: iojs.org]
* [HTTP/2] [1] [:path: /dist/]
* [HTTP/2] [1] [user-agent: curl/8.5.0]
* [HTTP/2] [1] [accept: */*]
* [HTTP/2] [1] [accept-encoding: deflate, gzip, br, zstd]
> HEAD /dist/ HTTP/2
> Host: iojs.org
> User-Agent: curl/8.5.0
> Accept: */*
> Accept-Encoding: deflate, gzip, br, zstd
>
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* old SSL session ID is stale, removing
< HTTP/2 200
HTTP/2 200
< date: Thu, 25 Jan 2024 19:49:09 GMT
date: Thu, 25 Jan 2024 19:49:09 GMT
< content-type: text/html
content-type: text/html
< strict-transport-security: max-age=0; preload
strict-transport-security: max-age=0; preload
< x-frame-options: DENY
x-frame-options: DENY
< x-content-type-options: nosniff
x-content-type-options: nosniff
< last-modified: Thu, 25 Jan 2024 19:38:22 GMT
last-modified: Thu, 25 Jan 2024 19:38:22 GMT
< cache-control: max-age=14400
cache-control: max-age=14400
< cf-cache-status: HIT
cf-cache-status: HIT
< report-to: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=NbrHUNOalhhHPT9%2FdFLTNIgphIk2xtFW5WDeiGDuna3gIEfQgYil5TN1q2NCFjlIIlow7mv%2FxMCxl%2BG1B7XwrcDEdcZ%2FfiXh58APOH57OIS1bI%2BqddnqJcw4ZAqO0m8HXPR%2BBlmRUA%3D%3D"}],"group":"cf-nel","max_age":604800}
report-to: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=NbrHUNOalhhHPT9%2FdFLTNIgphIk2xtFW5WDeiGDuna3gIEfQgYil5TN1q2NCFjlIIlow7mv%2FxMCxl%2BG1B7XwrcDEdcZ%2FfiXh58APOH57OIS1bI%2BqddnqJcw4ZAqO0m8HXPR%2BBlmRUA%3D%3D"}],"group":"cf-nel","max_age":604800}
< nel: {"success_fraction":0,"report_to":"cf-nel","max_age":604800}
nel: {"success_fraction":0,"report_to":"cf-nel","max_age":604800}
< vary: Accept-Encoding
vary: Accept-Encoding
< server: cloudflare
server: cloudflare
< cf-ray: 84b309b0ffcda1e6-YYZ
cf-ray: 84b309b0ffcda1e6-YYZ
< content-encoding: br
content-encoding: br
< alt-svc: h3=":443"; ma=86400
alt-svc: h3=":443"; ma=86400
<
* Connection #0 to host iojs.org left intact
hm, ok well that's not it either then.
This is some of the code running during that gap, assuming nvm_ls_remote_iojs works as expected (please try that):
https://github.com/nvm-sh/nvm/blob/master/nvm.sh#L715-L718
which implicates sed, which your nvm debug describes as sed: /usr/bin/sed, sed (GNU sed) 4.9 - is there any chance there's something going on with that?
My sed looks like, do you got an expression I can test for you?
Can you run nvm_ls_remote_iojs and make sure it prints out this:
iojs-v1.0.0
iojs-v1.0.1
iojs-v1.0.2
iojs-v1.0.3
iojs-v1.0.4
iojs-v1.1.0
iojs-v1.2.0
iojs-v1.3.0
iojs-v1.4.1
iojs-v1.4.2
iojs-v1.4.3
iojs-v1.5.0
iojs-v1.5.1
iojs-v1.6.0
iojs-v1.6.1
iojs-v1.6.2
iojs-v1.6.3
iojs-v1.6.4
iojs-v1.7.1
iojs-v1.8.1
iojs-v1.8.2
iojs-v1.8.3
iojs-v1.8.4
iojs-v2.0.0
iojs-v2.0.1
iojs-v2.0.2
iojs-v2.1.0
iojs-v2.2.0
iojs-v2.2.1
iojs-v2.3.0
iojs-v2.3.1
iojs-v2.3.2
iojs-v2.3.3
iojs-v2.3.4
iojs-v2.4.0
iojs-v2.5.0
iojs-v3.0.0
iojs-v3.1.0
iojs-v3.2.0
iojs-v3.3.0
iojs-v3.3.1
$ nvm_ls_remote_iojs
iojs-v1.0.0
iojs-v1.0.1
iojs-v1.0.2
iojs-v1.0.3
iojs-v1.0.4
iojs-v1.1.0
iojs-v1.2.0
iojs-v1.3.0
iojs-v1.4.1
iojs-v1.4.2
iojs-v1.4.3
iojs-v1.5.0
iojs-v1.5.1
iojs-v1.6.0
iojs-v1.6.1
iojs-v1.6.2
iojs-v1.6.3
iojs-v1.6.4
iojs-v1.7.1
iojs-v1.8.1
iojs-v1.8.2
iojs-v1.8.3
iojs-v1.8.4
iojs-v2.0.0
iojs-v2.0.1
iojs-v2.0.2
iojs-v2.1.0
iojs-v2.2.0
iojs-v2.2.1
iojs-v2.3.0
iojs-v2.3.1
iojs-v2.3.2
iojs-v2.3.3
iojs-v2.3.4
iojs-v2.4.0
iojs-v2.5.0
iojs-v3.0.0
iojs-v3.1.0
iojs-v3.2.0
iojs-v3.3.0
iojs-v3.3.1
Can you edit your nvm.sh to see whether the "hang" happens before or after the VERSIONS= line?
From this screen shot this is where it's hanging. The behaviour is odd, before I would hit enter and it would continue. However it was eating all my keystrokes. So I type and not see anything, but the command I was trying would run when I hit Enter.
I tired "nvm ls" again and it is just hung and pressing enter is not doing anything.
hmm, another thought. Try TERM=dumb nvm ls (to disable colors)?
If that still hangs, please try nvm_remote_versions - and if not, then it's probably something with awk in nvm_print_versions.
Hi I tried "TERM=dumb nvm ls" several times and it doesn't hang.
hello was a update for this issue pushed, I am not seeing this problem in version 0.39.7
No - v0.39.7 is the same version you reported the problem in, so that suggests it was something else on your machine. Closing for now, but happy to reopen if needed.