Skip to content

Instantly share code, notes, and snippets.

@karansinghgit
Last active June 29, 2020 09:05
Show Gist options
  • Save karansinghgit/86bf9aee6a4a2b99401aa59ffdb0a1dd to your computer and use it in GitHub Desktop.
Save karansinghgit/86bf9aee6a4a2b99401aa59ffdb0a1dd to your computer and use it in GitHub Desktop.
How to Setup Node on WSL

DO NOT INSTALL NODE.JS FROM THE WEBSITE

If you happen to have previous installations, uninstall them before proceeding any further.

  1. Do a manual install of NVM from here.

    Currently the instructions are:

    export NVM_DIR="$HOME/.nvm" && (
      git clone https://github.com/nvm-sh/nvm.git "$NVM_DIR"
      cd "$NVM_DIR"
      git checkout `git describe --abbrev=0 --tags --match "v[0-9]*" $(git rev-list --tags --max-count=1)`
    ) && \. "$NVM_DIR/nvm.sh"
    
  2. Make Changes to /etc/profile by adding:

     export NVM_DIR="$HOME/.nvm"
     [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
    
  3. Verify your installation:

     command -v nvm
    

    It should output nvm

  4. Install a node version. Preferably, a long term stable one and not the latest node version. Latest version is more likely to be buggy.

    DO: nvm install --lts and NOT: nvm install node

  5. Verify Node and NPM installations: node --version and npm --version

  6. Download any node extension pack from VSCode marketplace

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment