nvm-sh / nvm

Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions
MIT License
80.02k stars 8.01k forks source link

NVM ls-remote returning N/A #3055

Open jorge-j1m opened 1 year ago

jorge-j1m commented 1 year ago

Operating system and version:

Ubuntu 22.04

nvm debug output:

```sh nvm --version: v0.39.3 $SHELL: /usr/bin/zsh $SHLVL: 1 whoami: 'jorge' ${HOME}: /home/jorge ${NVM_DIR}: '${HOME}/.config/nvm' ${PATH}: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin $PREFIX: '' ${NPM_CONFIG_PREFIX}: '' $NVM_NODEJS_ORG_MIRROR: '' $NVM_IOJS_ORG_MIRROR: '' shell version: 'zsh 5.8.1 (x86_64-ubuntu-linux-gnu)' uname -a: 'Linux 5.19.0-35-generic #36~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Fri Feb 17 15:17:25 UTC 2 x86_64 x86_64 x86_64 GNU/Linux' checksum binary: 'sha256sum' OS version: Ubuntu 22.04.2 LTS random-funcs: srandom/random regex-funcs: internal compiled limits: sprintf buffer 8192 maximum-integer 2147483647 awk: , mawk 1.3.4 20200120 curl: , curl 7.81.0 (x86_64-pc-linux-gnu) libcurl/7.81.0 OpenSSL/3.0.2 zlib/1.2.11 brotli/1.0.9 zstd/1.4.8 libidn2/2.3.2 libpsl/0.21.0 (+libidn2/2.3.2) libssh/0.9.6/openssl/zlib nghttp2/1.43.0 librtmp/2.3 OpenLDAP/2.5.13 wget: , GNU Wget 1.21.2 built on linux-gnu. ls: cannot access '': No such file or directory git: , usage: git [--version] [--help] [-C ] [-c =] ls: cannot access '': No such file or directory grep: , ls: cannot access '': No such file or directory sed: , Usage: sed [OPTION]... {script-only-if-no-other-script} [input-file]... ls: cannot access '': No such file or directory cut: , Usage: cut OPTION... [FILE]... ls: cannot access '': No such file or directory basename: , Usage: basename NAME [SUFFIX] ls: cannot access '': No such file or directory rm: , Usage: rm [OPTION]... [FILE]... ls: cannot access '': No such file or directory mkdir: , Usage: mkdir [OPTION]... DIRECTORY... ls: cannot access '': No such file or directory xargs: , Usage: xargs [OPTION]... COMMAND [INITIAL-ARGS]... nvm current: none which node: node not found which iojs: iojs not found which npm: npm not found npm config get prefix: nvm:271: command not found: npm npm root -g: nvm:271: command not found: npm ```

nvm ls output:

```sh N/A iojs -> N/A (default) node -> stable (-> N/A) (default) unstable -> N/A (default) lts/* -> lts/hydrogen (-> ∞) 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.19.1 (-> N/A) lts/hydrogen -> v18.15.0 (-> N/A) ```

How did you install nvm?

Install script

What steps did you perform?

curl script | bash

What happened?

Running nvm install X doesn't work, after doing nvm ls-remote then all I get is N/A. I've confirmed it's not an issue with curl, or the CA, unsure what else I should be checking.

What did you expect to happen?

Being able to install a specific node version

Is there anything in any of your profile files that modifies the PATH?

No

If you are having installation issues, or getting "N/A", what does curl -I --compressed -v https://nodejs.org/dist/ print out?

```sh * Trying 2606:4700:10::6814:162e:443... * Connected to nodejs.org (2606:4700:10::6814:162e) port 443 (#0) * ALPN, offering h2 * ALPN, offering http/1.1 * CAfile: /etc/ssl/certs/ca-certificates.crt * CApath: /etc/ssl/certs * TLSv1.0 (OUT), TLS header, Certificate Status (22): * TLSv1.3 (OUT), TLS handshake, Client hello (1): * TLSv1.2 (IN), TLS header, Certificate Status (22): * TLSv1.3 (IN), TLS handshake, Server hello (2): * TLSv1.2 (IN), TLS header, Finished (20): * TLSv1.2 (IN), TLS header, Supplemental data (23): * 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.2 (OUT), TLS header, Finished (20): * TLSv1.3 (OUT), TLS change cipher, Change cipher spec (1): * TLSv1.2 (OUT), TLS header, Supplemental data (23): * TLSv1.3 (OUT), TLS handshake, Finished (20): * SSL connection using TLSv1.3 / TLS_AES_256_GCM_SHA384 * ALPN, server accepted to use h2 * Server certificate: * subject: CN=*.nodejs.org * start date: Feb 3 00:00:00 2023 GMT * expire date: Mar 5 23:59:59 2024 GMT * subjectAltName: host "nodejs.org" matched cert's "nodejs.org" * issuer: C=GB; ST=Greater Manchester; L=Salford; O=Sectigo Limited; CN=Sectigo RSA Domain Validation Secure Server CA * SSL certificate verify ok. * Using HTTP2, server supports multiplexing * Connection state changed (HTTP/2 confirmed) * Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0 * TLSv1.2 (OUT), TLS header, Supplemental data (23): * TLSv1.2 (OUT), TLS header, Supplemental data (23): * TLSv1.2 (OUT), TLS header, Supplemental data (23): * Using Stream ID: 1 (easy handle 0x563243ec4e90) * TLSv1.2 (OUT), TLS header, Supplemental data (23): > HEAD /dist/ HTTP/2 > Host: nodejs.org > user-agent: curl/7.81.0 > accept: */* > accept-encoding: deflate, gzip, br, zstd > * TLSv1.2 (IN), TLS header, Supplemental data (23): * TLSv1.3 (IN), TLS handshake, Newsession Ticket (4): * TLSv1.3 (IN), TLS handshake, Newsession Ticket (4): * old SSL session ID is stale, removing * TLSv1.2 (IN), TLS header, Supplemental data (23): * Connection state changed (MAX_CONCURRENT_STREAMS == 256)! * TLSv1.2 (OUT), TLS header, Supplemental data (23): * TLSv1.2 (IN), TLS header, Supplemental data (23): < HTTP/2 200 HTTP/2 200 < date: Fri, 10 Mar 2023 01:07:24 GMT date: Fri, 10 Mar 2023 01:07:24 GMT < content-type: text/html content-type: text/html < last-modified: Thu, 09 Mar 2023 21:35:21 GMT last-modified: Thu, 09 Mar 2023 21:35:21 GMT < cache-control: max-age=14400 cache-control: max-age=14400 < cf-cache-status: HIT cf-cache-status: HIT < age: 813 age: 813 < vary: Accept-Encoding vary: Accept-Encoding < strict-transport-security: max-age=31536000; includeSubDomains; preload strict-transport-security: max-age=31536000; includeSubDomains; preload < x-content-type-options: nosniff x-content-type-options: nosniff < server: cloudflare server: cloudflare < cf-ray: 7aXXXXXXXXX-XXX (X'ed on purpose) cf-ray: 7aXXXXXXXXX-XXX (X'ed on purpose) < content-encoding: br content-encoding: br < * Connection #0 to host nodejs.org left intact ```
ljharb commented 1 year ago

the nvm debug output has a lot of unexpected errors in it - the ls ones in particular. I suspect that's contributing.

Have you manually installed or updated any of the core posix utilities listed?

jorge-j1m commented 1 year ago

I installed it using the fish shell and I had to edit a few stuff for it to work, but I completely got rid of that, including my old nvm insallation, and I'm trying now from zsh. How can I debug these ls issues, what's the expected result there? @ljharb

alaslyalasel commented 1 year ago

alasly alasyl

ljharb commented 1 year ago

@jorge-j1m note that nvm doesn't support fish, because fish isn't POSIX-compliant.

Here's my nvm debug output, as a comparison:

nvm --version: v0.39.3
$TERM_PROGRAM: Apple_Terminal
$SHELL: /bin/bash
$SHLVL: 1
whoami: 'ljharb'
${HOME}: /Users/ljharb
${NVM_DIR}: '${HOME}/.nvm'
${PATH}: ${NVM_DIR}/versions/node/v19.7.0/bin:/usr/local/bin:${HOME}/bin:/usr/local/opt/openssl/bin:${HOME}/.jsvu:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/MacGPG2/bin:/Library/Apple/usr/bin:/usr/local/git/bin
$PREFIX: ''
${NPM_CONFIG_PREFIX}: ''
$NVM_NODEJS_ORG_MIRROR: ''
$NVM_IOJS_ORG_MIRROR: ''
shell version: 'GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin20)'
uname -a: 'Darwin 20.6.0 Darwin Kernel Version 20.6.0: Sun Nov 6 23:17:00 PST 2022; root:xnu-7195.141.46~1/RELEASE_X86_64 x86_64'
checksum binary: 'shasum'
OS version: macOS 11.7.2 20G1020
awk: /usr/bin/awk, awk version 20200816
curl: /usr/bin/curl, curl 7.64.1 (x86_64-apple-darwin20.0) libcurl/7.64.1 (SecureTransport) LibreSSL/2.8.3 zlib/1.2.11 nghttp2/1.41.0
wget: /usr/local/bin/wget, GNU Wget 1.21.3 built on darwin20.6.0.
sed: /usr/bin/sed
cut: /usr/bin/cut
basename: /usr/bin/basename
rm: /bin/rm
mkdir: /bin/mkdir
xargs: /usr/bin/xargs
git: /usr/local/bin/git, git version 2.33.0
grep: /usr/bin/grep (\grep --color), grep (BSD grep) 2.5.1-FreeBSD
nvm current: v19.7.0
which node: ${NVM_DIR}/versions/node/v19.7.0/bin/node
which iojs: 
which npm: ${NVM_DIR}/versions/node/v19.7.0/bin/npm
npm config get prefix: ${NVM_DIR}/versions/node/v19.7.0
npm root -g: ${NVM_DIR}/versions/node/v19.7.0/lib/node_modules
rkayala commented 1 year ago

Same issue for me too This is what am getting curl -I --compressed -v https://nodejs.org/dist/

<

ljharb commented 1 year ago

@rkayala that output suggests it should be working fine, but the "Optum IT Web Proxy HTTPS Proxy" line suggests that you have a proxy, your ~/.curlrc is set up to use it, but nvm explicitly ignores curlrc, so nvm can't get through your proxy.