The solution was found on a Reddit post down in the comments. Apparently, there’s some kind of issue happening in the DNS resolver.
Run the following commands in WSL. Substitute 126.96.36.199 with a DNS resolver of your choice.
sudo rm /etc/resolv.conf sudo bash -c 'echo "nameserver 188.8.131.52" > /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
Then run the following command in a prompt with admin privilege
No guarantee this won’t cause other issues down the road, but it solved my NPM install problem.