2025-03-14 21:59:59 -06:00
|
|
|
# nvm
|
|
|
|
|
|
2026-02-18 06:55:01 -07:00
|
|
|
> Install, uninstall, or switch between Node.js versions.
|
2026-06-12 17:51:25 -06:00
|
|
|
> Supports version numbers like "12.8" or "v16.13.1", and labels like "node", "system", etc.
|
2025-03-14 21:59:59 -06:00
|
|
|
> See also: `asdf`.
|
2026-02-18 06:55:01 -07:00
|
|
|
> More information: <https://github.com/nvm-sh/nvm#usage>.
|
2025-03-14 21:59:59 -06:00
|
|
|
|
2026-06-12 17:51:25 -06:00
|
|
|
- Install/uninstall a specific version of Node.js:
|
2025-03-14 21:59:59 -06:00
|
|
|
|
2026-06-12 17:51:25 -06:00
|
|
|
`nvm {{install|uninstall}} {{node_version}}`
|
2025-03-14 21:59:59 -06:00
|
|
|
|
|
|
|
|
- Use a specific version of Node.js in the current shell:
|
|
|
|
|
|
|
|
|
|
`nvm use {{node_version}}`
|
|
|
|
|
|
|
|
|
|
- Set the default Node.js version:
|
|
|
|
|
|
|
|
|
|
`nvm alias default {{node_version}}`
|
|
|
|
|
|
2026-06-12 17:51:25 -06:00
|
|
|
- List remote versions available for install, only show LTS (long-term support) versions:
|
2025-03-14 21:59:59 -06:00
|
|
|
|
2026-06-12 17:51:25 -06:00
|
|
|
`nvm ls-remote --lts`
|
2025-03-14 21:59:59 -06:00
|
|
|
|
2026-06-12 17:51:25 -06:00
|
|
|
- List installed versions:
|
2025-03-14 21:59:59 -06:00
|
|
|
|
2026-06-12 17:51:25 -06:00
|
|
|
`nvm {{[ls|list]}}`
|
2025-03-14 21:59:59 -06:00
|
|
|
|
|
|
|
|
- Launch the REPL of a specific version of Node.js:
|
|
|
|
|
|
2026-06-12 17:51:25 -06:00
|
|
|
`nvm run {{node_version}}`
|
2025-03-14 21:59:59 -06:00
|
|
|
|
|
|
|
|
- Execute a script in a specific version of Node.js:
|
|
|
|
|
|
2026-06-12 17:51:25 -06:00
|
|
|
`nvm exec {{node_version}} node {{path/to/script.js}}`
|
|
|
|
|
|
|
|
|
|
- Upgrade to the latest working npm version on the current Node.js version:
|
|
|
|
|
|
|
|
|
|
`nvm install-latest-npm`
|