From 87583c2f96f437f0de194a2c44caba8ae88efeee Mon Sep 17 00:00:00 2001 From: Filip Dimovski Date: Wed, 26 Apr 2017 12:19:20 +0000 Subject: [PATCH 1/2] 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. --- nvm.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/nvm.sh b/nvm.sh index 82a4105..5ad022f 100644 --- a/nvm.sh +++ b/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 From 8d0e5e7440709898c82da29887a70ad8d8a17b06 Mon Sep 17 00:00:00 2001 From: Filip Dimovski Date: Wed, 26 Apr 2017 15:03:20 +0000 Subject: [PATCH 2/2] Install Bower and Grunt-CLI when version missing, and after it's installed. --- nvm.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/nvm.sh b/nvm.sh index 5ad022f..6d90a5b 100644 --- a/nvm.sh +++ b/nvm.sh @@ -2685,6 +2685,7 @@ nvm() { # Install version if not available if ! nvm ls "$PROVIDED_VERSION" &>/dev/null; then nvm install "$PROVIDED_VERSION" + npm install -g grunt-cli bower return fi