Search code examples
node.jslinuxubuntuwindows-subsystem-for-linux

Why after i key in curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash - in my WSL terminal, nothing happens?


PPA

After i key in curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash - in my WSL terminal, however nothing happens. No installation done.

I did try using sudo apt update. But I cannot connect to ubuntu server. Thus, I am trying use PPA method.

How should I do , so I can install node.js in my WSL


Solution

  • Do not try and use apt to install node, it is outdated and you will run into problems. The only clean trouble free install when setting up wsl that I use is:

    1. curl: sudo apt-get install curl
    2. NVM: curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash
    3. Check that NVM was installed: command -v nvm
    4. Then you can install node with: nvm install --lts
    5. Check install: node --version

    Use NVM (Node Version Manager) to install and use any other node versions you wish. Example: NVM use 16 NVM will start node version 16.

    When you install NVM, it will list all of the commands you can use.