Steve
Steve

Reputation: 14912

NVM on WSL2: cannot install Node, version not found

I installed WSL from the Microsoft Store onto Windows 10. I was able to succesfully install NVM onto this using the curl command as documented on https://github.com/nvm-sh/nvm

NVM installs, I can run commands and check the version.

However when I try to install node, either a specific version like nvm install 12.18.1 or nvm install or nvm install --lts I get a message that the version is not found

me:~$ nvm install 12.18.1
Version '12.18.1' not found - try `nvm ls-remote` to browse available versions.

or

me:~$ nvm install --lts
Installing latest LTS version.
Version '' (with LTS filter) not found - try `nvm ls-remote --lts` to browse available versions.

If I try to run nvm ls-remote, after several seconds I get N/A

I have installed this before on MacOS and on a different non-work Windows 10 box and have not seen this behavior before. It's like it is not hitting the nodejs server.

Thoughts?

Upvotes: 5

Views: 9700

Answers (1)

Anthony Phan
Anthony Phan

Reputation: 423

I had experienced the same issue on a work laptop running WSL2. It was caused by a proxy/firewall solution (ZScaler) installed on the PC which was blocking connections to nodejs.org. To test is this is the issue you can run the command below to see if it runs successfully


curl -I --compressed -v https://nodejs.org/dist/

The solution for me was to run a VPN on my PC which would bypass that restrictions of the corporate proxy and allow me to download the node versions required. Alternatively you can work with your IT department to have nodejs.org unblocked.

Upvotes: 8

Related Questions