Search code examples
ubuntuwindows-subsystem-for-linux

Installing NPM/Node on Bash on Ubuntu on Windows (WSL). What architecture does Ubuntu/Bash use?


I'm using Bash on Ubuntu on Windows as the command line tool.

I need to install Node and NPM, and on the download page for unix I need to choose between 5 different options: 32bits, 64 bits, ArmV6, ArmV7, Armv8. Arms themselves are either 32 or 64 bit so this left me a confused.

Are Arm versions meant for mobile devices? I couldn't find Bash/Ubuntu in any directory, and not in the 64 bit program directory.

If my Windows is 64 bit, can I assume that Bash/Ubuntu will be 64 bits as well, and that that is the right file to download?


Solution

  • To install node and npm in Ubuntu on WSL you need to install nvm. It doesn't work with apt-install

    1. Install NVM

    curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.0/install.sh | bash

    1. Edit ~/.bashrc or ~/.zshrc depending on the Linux Shell you're using and add the following at the bottom

    export NVM_DIR="/home/yourusername/.nvm" [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"

    Now restart bash, and then run

    nvm install node

    That will install the latest, if you wish to install a specific version

    nvm install v6.11.5

    You're all set.

    Credit : https://winsmarts.com/how-to-install-node-on-linux-on-windows-wsl-65069ea5f83d