Install a version before use

Now 'nvm use' checks whether the version is installed before it is used.
If the version is missing, it will call 'nvm install' and install it.
Otherwise, if the version is present, it will use it and continue as usual.
This commit is contained in:
Filip Dimovski 2017-04-26 12:19:20 +00:00
parent 0a95e77000
commit 87583c2f96

6
nvm.sh
View File

@ -2682,6 +2682,12 @@ nvm() {
return 127
fi
# Install version if not available
if ! nvm ls "$PROVIDED_VERSION" &>/dev/null; then
nvm install "$PROVIDED_VERSION"
return
fi
if [ "_$VERSION" = '_system' ]; then
if nvm_has_system_node && nvm deactivate >/dev/null 2>&1; then
if [ $NVM_USE_SILENT -ne 1 ]; then