mirror of
https://github.com/nvm-sh/nvm.git
synced 2025-05-10 22:31:51 +00:00
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:
parent
0a95e77000
commit
87583c2f96
6
nvm.sh
6
nvm.sh
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user