[Fix] nvm exec: Do a version check on nvm-exec

This check would display a message in case the `.nvmrc` version is not installed, and would not alter the output otherwise.
This commit is contained in:
Bark
2024-03-06 16:03:10 +02:00
committed by Jordan Harband
parent 0fbe3a6776
commit 01a8749d7f
3 changed files with 30 additions and 7 deletions

View File

@@ -9,9 +9,12 @@ unset NVM_CD_FLAGS
if [ -n "$NODE_VERSION" ]; then
nvm use "$NODE_VERSION" > /dev/null || exit 127
elif ! nvm use >/dev/null 2>&1; then
echo "No NODE_VERSION provided; no .nvmrc file found" >&2
exit 127
else
nvm_rc_version > /dev/null && nvm_ensure_version_installed "$NVM_RC_VERSION";
if ! nvm use >/dev/null 2>&1; then
echo "No NODE_VERSION provided; no .nvmrc file found" >&2
exit 127
fi
fi
exec "$@"