Command Workflows
This guide explains common end-to-end CLI workflows.
1) New Machine Bootstrap
Install the latest LTS version of Node.js:
nvm install lts
Set as default version:
nvm use lts
Verify the default version:
nvm default
node -v
Optional validation:
nvm env
nvm doctor
2) Multi-Version Project Testing
Install multiple versions of Node.js at once:
nvm install 18 20 22
All versions will be downloaded in parallel, then installed sequentially.
Switch between versions for testing:
nvm use 18
npm test
nvm use 20
npm test
nvm use 22
npm test
Use aliases for convenience:
nvm alias add legacy 18.20.8
nvm alias add modern 24.1.0
3) Project Pinning with Run Command Files
Set default version and create a local .nvmrc file:
nvm use 24
nvm rc 24 --file=.nvmrc
Or update package engines:
nvm rc 24 --file=package.json
4) Download-Constrained Environments
Pre-cache artifacts:
nvm cache add 20 22 24
nvm cache view
Use cache controls during install:
nvm install 24 --cache
Cleanup after rollout:
nvm cache remove version 20.19.1
nvm cache remove all
5) Runtime Mode Management
Switch mode:
nvm use shim
nvm use link
Temporarily disable/enable nvm:
nvm off
nvm on
6) Configuration and Policy-Aware Operations
Inspect effective values:
nvm config list
nvm config get mode root auto_install
Apply updates:
nvm config set mode=shim auto_install=true
Reset to defaults:
nvm config reset auto_install
7) Health and Upgrade Workflow
nvm doctor --list
nvm doctor --autofix
nvm upgrade --check
nvm upgrade