Install n
Open your terminal.
Run the command:
npm install -g n
Switch to a specific Node.js version
Run the command:
n <version>
(replace <version> with the desired version, e.g., n 16.17.0)
Verify the version change by running:
node -v
Switch to the latest Node.js version
Run the command:
n latest
Verify the version change by running:
node -v
List all installed Node.js versions
Run the command:
n ls
Uninstall a specific Node.js version
Run the command:
n rm <version>
(replace <version> with the version you want to uninstall)