nvm is a version manager for node.js which lets you easily switch between different node versions. You can define an .nvmrc file in your node project which enforces the node version standardization with your codebase collaborators.
Install
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash.bashrc
# make sure you have this code
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion.bash_profile
if [ -f ~/.bashrc ]; then
source ~/.bashrc
fiYou have to exit the Terminal then open again for the change to take effect.
Create a .nvmrc file in the same directory as your package.json.
Run nvm use before you run npm install or yarn.