The Node version manager, nvm, is strongly recommended to manage your version of Node.js and npm.
It also allows switching between various versions of Node (Nodejs and npm) for testing purposes.
As per official docs, nvm is designed to be installed per-user and invoked per-shell. It works on "any POSIX compliant shell" - including on Unix, macOS and WSL.
Once you install nvm (by wget'ing the installation shell script and piping it to bash) you can restart WSL and start using nvm.
Some nvm commands to know:
nvm install node # install latest version
nvm install --lts # install latest LTS version
nvm use node # switches to latest version
nvm use <version> #switch to a specific version
To see all Node versions, do nvm ls. Node uses semantic versioning, following the pattern MAJOR.MINOR.PATCH.
nvm ls shows the version active in shell in blue, and installed versions in green. Yellow are versions referenced by aliases but not installed.
No comments:
Post a Comment