nvm command not found :(

duhbhavesh profile image Bhavesh Kasturi ・1 min read

Node Version Manager (NVM) is a tool used to manage multiple active Node.js versions.

If you're trying to install NVM(Node Version Manager) in WSL you probably may run into this error.
-bash: nvm: command not found

What is WSL ?

The Windows Subsystem for Linux lets developers run a GNU/Linux environment -- including most command-line tools, utilities, and applications -- directly on Windows, unmodified, without the overhead of a traditional virtual machine or dual-boot setup.

How to fix this error ?

  • Installation

To install nvm use the following cURL or Wget command
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash

wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash

  • nvm command not found :(

Running either of the above commands downloads a script and runs it, but if you type nvm and if you get bash: nvm: command not found it happens because the source is missing from the following profile files (~/.bash_profile, ~/.zshrc, ~/.profile, or ~/.bashrc) To fix this simply follow these steps.

  • Steps

1) nano ~/.zshrc

2) Add the source lines from the snippet below to the correct profile file at the bottom.
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm

3) Close and restart the terminal it should fix the error!

The official documentation on GitHub is really helpful.

Thanks for reading!

Posted on by:


markdown guide