nvm-sh / nvm

Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Feature Idea: nvm update [<version>] [<version>]

NotLazy opened this issue · comments

This command would work very similar to nvm install, but it would allow users to update to the latest minor or patch of installed .

This is already possible with the --reinstall-packages-from flag. This command would just be a bit more human-friendly, as well as reduce how many commands it takes to update Node without losing packages.

nvm update current could be equivalent to the below commands, assuming current is 16.13 and 16.14 is the latest (even though it isn't at the time of writing this.)

nvm install 16.14 --reinstall-packages-from=16.13
nvm uninstall 16.13

The extended syntax, nvm update [<version>] [<version>] would allow users to nvm update current 16.14 or nvm update current 16.13.2 to manually select what version to update to.

some more examples of usage

nvm update node 			# updates to latest stable
nvm update lts/gallium 			# updates 16.x to 16.19.0 (as of the time of writing this)
nvm update 16.14 16.19 			# updates 16.14 to 16.19.0 (as of the time of writing this)
nvm update 14 16 			# updates 14.x to 16.19.0 (as of the time of writing this)

this command could also be nvm replace or open to suggestions, since the command could be used to downgrade using
nvm update 16.14 16.13

Duplicate of #1091.