Windows 11 업그레이드 후, WSL 에서 npm install 멈춤
Windows 11 업그레이드 이후 오랜만에 toy project 를 돌려보려고
npm install 을 수행했는데 뭔가 진행이 안된다
처음에는 멈춤줄 알았는데, 엄청 느려졌음
일단 원인은 nameserver 가 잘못 설정되어 있었다.
/etc/resolv.conf 에 nameserver 가 172.18.240.1 로 되어 있었고
ping 을 해보면 응답이 없는 상태
resolv.conf 파일을 열어 보면, 자동으로 생성되는 파일이라서
멈추려면 /etc/wsl.conf 를 추가 하라고 되어 있음
cat /etc/resolv.conf
# This file was automatically generated by WSL. To stop automatic generation of this file, add the following entry to /etc/wsl.conf:
# [network]
# generateResolvConf = false
이 nameserver 를 8.8.8.8 로 바꿔주자
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
출처: https://github.com/microsoft/WSL/issues/4901#issuecomment-909723742