This article will show you how to update node.js version on mac OS with command line
Check current installed node.js version
# Check your current node.js version, by open terminal tool and type below command:
node -v
Example output:
v16.13.0
Install n package
npm install -g n
Install desired node version
# Example to update nodejs version to 16.14.0
sudo n install 16.14.0
Example output:
installing : node-v16.14.0
mkdir : /usr/local/n/versions/node/16.14.0
fetch : https://nodejs.org/dist/v16.14.0/node-v16.14.0-darwin-x64.tar.xz
copying : node/16.14.0
installed : v16.14.0 (with npm 8.3.1)
Verify your node.js version
# Check your current node.js version
node -v