1

I'm having trouble installing nodejs and npm on my newly installed WSL2. I've set the WSL up according to the instructions from Microsoft and downloaded the Ubuntu program from Windows Store. I tried running both sudo apt-get install npm and sudo apt-get install nodejs but the answer I get is just "Unable to locate package". I googled a little and found that I could install it via nvm using cURL (curl -v -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash), but cURL manages to set up the TCP connection and then promptly just runs without downloading anything, just running a timer on how long it's been going.

What am I doing wrong? My first thought was that I don't have an internet connection, but it should be running on my Windows connection, and as I say, the TCP is connected correctly because I get no connection errors. Any help on this matter is appreciated!

EDIT: I tried running sudo apt update and I get connection errors to archive.ubuntu.com and security.ubuntu.com which I presume is the servers it's supposed to download the packages from. I get no other error messages except for the servers not answering and the connection timing out, however I can ping both servers and get an answer very quickly. Forcing it to use IPv4 instead of IPv6 which was suggested on another site did not work either.

EDIT2: This is a corporate computer (which I am admin on) on my private network, but I will look into it to see if there are any specific settings I have to enable to give my Ubuntu terminal access or even if I have to be on the corporate network.

Sara
  • 11

1 Answers1

0

The answer was a simple one: my firewall was blocking the connection somehow (my guess is that it blocked all outgoing TCP connections that weren't whitelisted). If you have a similar problem it might be a good idea to try to turn off the firewall for a couple of minutes while you install the things you want, or to find a way to let your WSL through if you can't turn it off.

Sara
  • 11