Skip to content

Instantly share code, notes, and snippets.

@mohit-raj-purohit
Forked from chranderson/nvmCommands.js
Created April 6, 2023 12:00
Show Gist options
  • Save mohit-raj-purohit/04abdc74c662484ddd41f40978f2242b to your computer and use it in GitHub Desktop.
Save mohit-raj-purohit/04abdc74c662484ddd41f40978f2242b to your computer and use it in GitHub Desktop.
Useful NVM commands
// check version
node -v || node --version
// list installed versions of node (via nvm)
nvm ls
// install specific version of node
nvm install 6.9.2
// set default version of node
nvm alias default 6.9.2
// switch version of node
nvm use 6.9.1
@mohit-raj-purohit
Copy link
Author

Example:

nvm install 8.0.0 Install a specific version number

nvm use 8.0 Use the latest available 8.0.x release

nvm run 6.10.3 app.js Run app.js using node 6.10.3

nvm exec 4.8.3 node app.js Run node app.js with the PATH pointing to node 4.8.3

nvm alias default 8.1.0 Set default node version on a shell

nvm alias default node Always default to the latest available node version on a shell

nvm install node Install the latest available version

nvm use node Use the latest version

nvm install --lts Install the latest LTS version

nvm use --lts Use the latest LTS version

nvm set-colors cgYmW Set text colors to cyan, green, bold yellow, magenta, and white

Note:
to remove, delete, or uninstall nvm - just remove the $NVM_DIR folder (usually ~/.nvm)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment