'Command to download latest version of nvm?

I am trying to install the latest version of nvm so (per this article) I ran:

nvm install 4.0

It worked. But I want to make sure I install the latest version of nvm as they might have released a newer version after the article was written.

Is there a command I can run to download the latest version of nvm?



Solution 1:[1]

These answers are all about updating the version of Node, when the original question is about updating the version of the NVM tool itself.

The script to update NVM is:

$ curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash

and you can find the list of the latest releases here: https://github.com/nvm-sh/nvm/releases

More details found here: https://techsparx.com/nodejs/howto/nvm-deprecate-mirror.html

Solution 2:[2]

You can run nvm install node to get the latest node release.

Solution 3:[3]

The only solution I have found so far involves a two-step process.

Step 1: List all the released versions.

nvm ls-remote

At the present time, the last item on this list is...

...
...
...
v6.1.0

Step 2: Download latest version on the list of available versions.

nvm install 6.1.0

Solution 4:[4]

To automatically pick the most recent nvm tool version instead of having to look up the part like v0.39.1 for the wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash command the following bash script can be used:

#!/bin/bash

nvm_string="nvm-sh/nvm";

git_latest_version() {
   basename $(curl -fs -o/dev/null -w %{redirect_url} https://github.com/$1/releases/latest)
}

latest_version_number=$(git_latest_version "${nvm_string}");
#echo ${latest_version_number}
wget -qO- https://raw.githubusercontent.com/${nvm_string}/${latest_version_number}/install.sh | bash

Usage (Linux, Mac):

Make a new file like install-nvm.sh e.g. with vim or vi or whatever. Then copy paste the above script (type i to insert, type :wq to save it), then do sh install-nvm.sh;

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2
Solution 3
Solution 4