nvm-sh / nvm

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

curl to install nvm does not work on Windows 10 WSL #2412

Closed Sparrownor1 closed 3 years ago

Sparrownor1 commented 3 years ago

Operating system and version:

Windows 10 1903 Ubuntu 18.04

nvm debug output: N/A

```sh ```

nvm ls output: N/A

```sh ```

How did you install nvm?

Curl

What steps did you perform?

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash

What happened?

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 13527  100 13527    0     0  11263      0  0:00:01  0:00:01 --:--:-- 11263
=> Downloading nvm from git to '/home/sachit/.nvm'
=> Cloning into '/home/sachit/.nvm'...
fatal: unable to access 'https://github.com/nvm-sh/nvm.git/': Could not resolve host: github.com
Failed to clone nvm repo. Please report this!

Also 'command -v nvm' returns nothing

What did you expect to happen?

Successful installation

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

No, .bashrc exists but PATH is not modified inside it

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

```sh * Trying 104.20.23.46:443... * TCP_NODELAY set * Connected to nodejs.org (104.20.23.46) port 443 (#0) * ALPN, offering h2 * ALPN, offering http/1.1 * successfully set certificate verify locations: * CAfile: /etc/ssl/certs/ca-certificates.crt CApath: /etc/ssl/certs * 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 * ALPN, server accepted to use h2 * Server certificate: * subject: OU=Domain Control Validated; OU=PositiveSSL Wildcard; CN=*.nodejs.org * start date: Oct 21 00:00:00 2019 GMT * expire date: Jan 18 23:59:59 2022 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 multi-use * Connection state changed (HTTP/2 confirmed) * Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0 * Using Stream ID: 1 (easy handle 0x5618f18d1800) > HEAD /dist/ HTTP/2 > Host: nodejs.org > user-agent: curl/7.68.0 > accept: */* > accept-encoding: deflate, gzip, br > * TLSv1.3 (IN), TLS handshake, Newsession Ticket (4): * TLSv1.3 (IN), TLS handshake, Newsession Ticket (4): * old SSL session ID is stale, removing * Connection state changed (MAX_CONCURRENT_STREAMS == 256)! < HTTP/2 200 HTTP/2 200 < date: Thu, 14 Jan 2021 14:39:34 GMT date: Thu, 14 Jan 2021 14:39:34 GMT < content-type: text/html content-type: text/html < set-cookie: __cfduid=d7266bfeb96e95e60a3988ddfc09953531610635174; expires=Sat, 13-Feb-21 14:39:34 GMT; path=/; domain=.nodejs.org; HttpOnly; SameSite=Lax set-cookie: __cfduid=d7266bfeb96e95e60a3988ddfc09953531610635174; expires=Sat, 13-Feb-21 14:39:34 GMT; path=/; domain=.nodejs.org; HttpOnly; SameSite=Lax < cache-control: max-age=14400 cache-control: max-age=14400 < cf-cache-status: HIT cf-cache-status: HIT < cf-request-id: 07a2ef7a9e0000125a4a081000000001 cf-request-id: 07a2ef7a9e0000125a4a081000000001 < expect-ct: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" expect-ct: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" < vary: Accept-Encoding vary: Accept-Encoding < server: cloudflare server: cloudflare < cf-ray: 61181b70f82c125a-DXB cf-ray: 61181b70f82c125a-DXB < content-encoding: br content-encoding: br < * Connection #0 to host nodejs.org left intact ```
ljharb commented 3 years ago

Are you using WSL? nvm doesn’t work on windows otherwise.

ljharb commented 3 years ago

Ah, i see in the title you are. In that case, what happens if you try to use git to clone this repo directly?

Sparrownor1 commented 3 years ago

Similar output Cloning into 'nvm'... fatal: unable to access 'https://github.com/nvm-sh/nvm/': Could not resolve host: github.com

ljharb commented 3 years ago

This implies your computer can’t reach GitHub. What happens if you run curl -I --compressed -v https://github.com/nvm-sh/nvm ?

Sparrownor1 commented 3 years ago

That is kind of spooky but I cannot fathom as to why that would be the case. What could I do to fix it?

* Could not resolve host: github.com
* Closing connection 0
curl: (6) Could not resolve host: github.com
ljharb commented 3 years ago

Since i assume you’re accessing this page itself on the same machine, do you have any proxy settings set up in your web browser that the OS might lack?

ljharb commented 3 years ago

One possibility is that you have ipv6 enabled. Could you try disabling it?

Sparrownor1 commented 3 years ago

Since i assume you’re accessing this page itself on the same machine, do you have any proxy settings set up in your web browser that the OS might lack?

I reset my laptop today, and installed stock Chrome. I have not made any changes to any proxy settings to I suppose everything is still default.

One possibility is that you have ipv6 enabled. Could you try disabling it?

Attempting to right now

Sparrownor1 commented 3 years ago

Disabled ipv6 but still the same output

EDIT: also if it helps I am able to ping google.com but not ping github.com Error says Temporary failure in name resolution

ljharb commented 3 years ago

Try setting your dns servers to 8.8.8.8 or 1.1.1.1

Sparrownor1 commented 3 years ago
fatal: unable to access 'https://github.com/nvm-sh/nvm.git/': Operation timed out after 300041 milliseconds with 0 out of 0 bytes received
Failed to clone nvm repo. Please report this!
ljharb commented 3 years ago

I think I’ll close this as a duplicate of #2392 - hopefully something in there is helpful.

in general, there’s nothing nvm can do if your command line can’t connect to github :-/

Sparrownor1 commented 3 years ago

Here is the output from the curl -I stuff, it is different now. Posting this as the other thread had a 404 error but mine is 200

sachit@XPSachit:/mnt/c/Users/sachi$ curl -I --compressed -v https://github.com/nvm-sh/nvm
*   Trying 13.234.176.102:443...
* TCP_NODELAY set
* Connected to github.com (13.234.176.102) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
*   CAfile: /etc/ssl/certs/ca-certificates.crt
  CApath: /etc/ssl/certs
* 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_128_GCM_SHA256
* ALPN, server accepted to use http/1.1
* Server certificate:
*  subject: C=US; ST=California; L=San Francisco; O=GitHub, Inc.; CN=github.com
*  start date: May  5 00:00:00 2020 GMT
*  expire date: May 10 12:00:00 2022 GMT
*  subjectAltName: host "github.com" matched cert's "github.com"
*  issuer: C=US; O=DigiCert Inc; OU=www.digicert.com; CN=DigiCert SHA2 High Assurance Server CA
*  SSL certificate verify ok.
> HEAD /nvm-sh/nvm HTTP/1.1
> Host: github.com
> User-Agent: curl/7.68.0
> Accept: */*
> Accept-Encoding: deflate, gzip, br
>
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* old SSL session ID is stale, removing
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
HTTP/1.1 200 OK
< Date: Thu, 14 Jan 2021 17:03:12 GMT
Date: Thu, 14 Jan 2021 17:03:12 GMT
< Content-Type: text/html; charset=utf-8
Content-Type: text/html; charset=utf-8
< Server: GitHub.com
Server: GitHub.com
< Status: 200 OK
Status: 200 OK
< Vary: X-PJAX, Accept-Encoding, Accept, X-Requested-With, Accept-Encoding
Vary: X-PJAX, Accept-Encoding, Accept, X-Requested-With, Accept-Encoding
< ETag: W/"b200e37bbff538ad23ec63a155e4d5aa"
ETag: W/"b200e37bbff538ad23ec63a155e4d5aa"
< Cache-Control: max-age=0, private, must-revalidate
Cache-Control: max-age=0, private, must-revalidate
< Strict-Transport-Security: max-age=31536000; includeSubdomains; preload
Strict-Transport-Security: max-age=31536000; includeSubdomains; preload
< X-Frame-Options: deny
X-Frame-Options: deny
< X-Content-Type-Options: nosniff
X-Content-Type-Options: nosniff
< X-XSS-Protection: 1; mode=block
X-XSS-Protection: 1; mode=block
< Referrer-Policy: no-referrer-when-downgrade
Referrer-Policy: no-referrer-when-downgrade
< Expect-CT: max-age=2592000, report-uri="https://api.github.com/_private/browser/errors"
Expect-CT: max-age=2592000, report-uri="https://api.github.com/_private/browser/errors"
< Content-Security-Policy: default-src 'none'; base-uri 'self'; block-all-mixed-content; connect-src 'self' uploads.github.com www.githubstatus.com collector.githubapp.com api.github.com github-cloud.s3.amazonaws.com github-production-repository-file-5c1aeb.s3.amazonaws.com github-production-upload-manifest-file-7fdce7.s3.amazonaws.com github-production-user-asset-6210df.s3.amazonaws.com cdn.optimizely.com logx.optimizely.com/v1/events wss://alive.github.com online.visualstudio.com/api/v1/locations; font-src github.githubassets.com; form-action 'self' github.com gist.github.com; frame-ancestors 'none'; frame-src render.githubusercontent.com; img-src 'self' data: github.githubassets.com identicons.github.com collector.githubapp.com github-cloud.s3.amazonaws.com *.githubusercontent.com; manifest-src 'self'; media-src 'none'; script-src github.githubassets.com; style-src 'unsafe-inline' github.githubassets.com; worker-src github.com/socket-worker-5029ae85.js gist.github.com/socket-worker-5029ae85.js
Content-Security-Policy: default-src 'none'; base-uri 'self'; block-all-mixed-content; connect-src 'self' uploads.github.com www.githubstatus.com collector.githubapp.com api.github.com github-cloud.s3.amazonaws.com github-production-repository-file-5c1aeb.s3.amazonaws.com github-production-upload-manifest-file-7fdce7.s3.amazonaws.com github-production-user-asset-6210df.s3.amazonaws.com cdn.optimizely.com logx.optimizely.com/v1/events wss://alive.github.com online.visualstudio.com/api/v1/locations; font-src github.githubassets.com; form-action 'self' github.com gist.github.com; frame-ancestors 'none'; frame-src render.githubusercontent.com; img-src 'self' data: github.githubassets.com identicons.github.com collector.githubapp.com github-cloud.s3.amazonaws.com *.githubusercontent.com; manifest-src 'self'; media-src 'none'; script-src github.githubassets.com; style-src 'unsafe-inline' github.githubassets.com; worker-src github.com/socket-worker-5029ae85.js gist.github.com/socket-worker-5029ae85.js
< Content-Encoding: gzip
Content-Encoding: gzip
< Set-Cookie: _gh_sess=rxio1sRRZr%2F%2BsoSF6rHTtb6FvvIoB6KCKXGE8vycbFD2Co208CXbPzSAM%2FaRPXbN32y%2FTEB%2BfG2YGm6OocihdNwyqPp7H3y7yN17ok%2Bpge8Hxf2AbNMvJdM2QmWIouEGK7HWN2R%2F9nqUHtxeMU%2Bu%2Ftg1YzYLXvzcSn9iTBLZN3%2BY%2FEenU0ypSH7HO0JCO9ZzVHLeu1v9d4zWFppDTHh5QzO%2B97W8JD4%2FH4OhVTJAJJc7J0dFKGpjaewlwX%2F58ls73R7F6M6gb02D4JiZBB3XNQ%3D%3D--SNHWuj14kgjXhX8f--OamudN%2FJwURlO8FzcQdNvg%3D%3D; Path=/; HttpOnly;
Secure; SameSite=Lax
Set-Cookie: _gh_sess=rxio1sRRZr%2F%2BsoSF6rHTtb6FvvIoB6KCKXGE8vycbFD2Co208CXbPzSAM%2FaRPXbN32y%2FTEB%2BfG2YGm6OocihdNwyqPp7H3y7yN17ok%2Bpge8Hxf2AbNMvJdM2QmWIouEGK7HWN2R%2F9nqUHtxeMU%2Bu%2Ftg1YzYLXvzcSn9iTBLZN3%2BY%2FEenU0ypSH7HO0JCO9ZzVHLeu1v9d4zWFppDTHh5QzO%2B97W8JD4%2FH4OhVTJAJJc7J0dFKGpjaewlwX%2F58ls73R7F6M6gb02D4JiZBB3XNQ%3D%3D--SNHWuj14kgjXhX8f--OamudN%2FJwURlO8FzcQdNvg%3D%3D; Path=/; HttpOnly; Secure; SameSite=Lax
< Set-Cookie: _octo=GH1.1.2238791.1610643792; Path=/; Domain=github.com; Expires=Fri, 14 Jan 2022 17:03:12 GMT; Secure; SameSite=Lax
Set-Cookie: _octo=GH1.1.2238791.1610643792; Path=/; Domain=github.com; Expires=Fri, 14 Jan 2022 17:03:12 GMT; Secure; SameSite=Lax
< Set-Cookie: logged_in=no; Path=/; Domain=github.com; Expires=Fri, 14 Jan 2022 17:03:12 GMT; HttpOnly; Secure; SameSite=Lax
Set-Cookie: logged_in=no; Path=/; Domain=github.com; Expires=Fri, 14 Jan 2022 17:03:12 GMT; HttpOnly; Secure; SameSite=Lax
< Accept-Ranges: bytes
Accept-Ranges: bytes
< X-GitHub-Request-Id: C304:6F8F:D2C3:10EEC:60007950
X-GitHub-Request-Id: C304:6F8F:D2C3:10EEC:60007950

<
* Connection #0 to host github.com left intact
*
Sparrownor1 commented 3 years ago

Not an elegant solution but I uninstalled Ubuntu and after redownloading everything works fine

ljharb commented 3 years ago

Glad to hear it’s working! Sorry i wasn’t able to help find an easier solution.