When trying to install nvm with wsl 2 on windows 11, it throws:
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
when I try to ping google.com
it errors, while ping 8.8.8.8
works??!
you can try running this
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.