nvm icon indicating copy to clipboard operation
nvm copied to clipboard

It is not installing on wsl windows 11

Open mattjaf opened this issue 3 years ago • 9 comments

Operating system and version:

windows 11

nvm debug output:

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.2/install.sh | bash
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:--  0:00:09 --:--:--     0curl: (6) Could not resolve host: raw.githubusercontent.com

nvm ls output:


How did you install nvm?

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

What steps did you perform?

I installed wsl and then ran the command

What happened?

It didn't resolve

What did you expect to happen?

for it to install, instead it threw

(6) Could not resolve host: raw.githubusercontent.com

mattjaf avatar Nov 30 '22 02:11 mattjaf

This message implies your computer can’t connect to github - this isn’t something nvm can fix.

Are you located in a country or workplace that’s hostile to the internet? Theres not much to do about these kinds of network conditions besides relocating, either physically or using a vpn.

ljharb avatar Nov 30 '22 02:11 ljharb

I'm on a solid internet connection,

some people said they were able to solve it by switching to wsl 1

and that it might be anti virus or vpn related,

I'm on a brand new computer that I'm trying to create a back up image after I situate my environment.

I was hoping to find a more permanent solution.

mattjaf avatar Nov 30 '22 02:11 mattjaf

Interesting! I wouldn’t expect problems in that env. WSL1 isn’t fully posix compliant, i believe, so I’d suggest sticking to wsl2.

You could try investigating dns, and ipv6 settings, and see what things you can reach from windows but not wsl?

ljharb avatar Nov 30 '22 03:11 ljharb

I can ping 8.8.8.8 although I can't ping google.com

mattjaf avatar Dec 01 '22 00:12 mattjaf

This seemed to solve it!

sudo rm /etc/resolv.conf
sudo bash -c 'echo "nameserver 8.8.8.8" > /etc/resolv.conf'
sudo bash -c 'echo "[network]" > /etc/wsl.conf'
sudo bash -c 'echo "generateResolvConf = false" >> /etc/wsl.conf'
sudo chattr +i /etc/resolv.conf

it deletes your resolve.config file thats automatically generated when u run WSL then creates a new file and puts "nameserver 8.8.8.8", then creates a wsl.conf file and adds [network] and generateResolveConf = false to prevent auto generation of that file

you can also run

cat /etc/resolv.conf

to check the contents of the file

than

ping google.com

mattjaf avatar Dec 01 '22 01:12 mattjaf

Wow, thanks! Any chance you’d want to PR this into the troubleshooting section of the readme?

ljharb avatar Dec 01 '22 02:12 ljharb

I would be honored

mattjaf avatar Dec 01 '22 03:12 mattjaf

do you happen to know why my PR failed the eclint test and is it an issue?

mattjaf avatar Dec 01 '22 04:12 mattjaf

Not yet, and no, it's not :-) I'll figure it out when landing it. Thanks!

ljharb avatar Dec 01 '22 09:12 ljharb