Install nvm (node version manager), then install nodejs using nvm
on linux or mac
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash
The script clones nvm repository to ~/.nvm, and attempts to add source lines from the snippet below to one of the profile file (~/.bash_profile, ~/.zshrc, ~/.profile, or ~/.bashrc).
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
source ~/.bashrc or the other profile file that has the above nvm script
Install nodeJS
Install a specific node version
nvm install 18
Use node with version specified
nvm use 18
checkout installed versions
nvm ls
command explanation and help
nvm help
set default node version
nvm alias default 18
more about nvm, please checkout
if you want latest update and find more tips and tricks to build your own business platform, please checkout more articles on https://www.productdeploy.com and https://blog.productdeploy.com