[Fix] nvm-exec: improve the no-version failure message

The message claimed "no .nvmrc file found" even when one was found and its version simply was not installed,
and it never mentioned that `NODE_VERSION=default` selects the `default` alias.

Refs #3810
This commit is contained in:
Jordan Harband
2026-09-08 23:47:09 -07:00
parent cd84623ab2
commit 74bb42ee23
2 changed files with 36 additions and 3 deletions
+3 -1
View File
@@ -12,7 +12,9 @@ if [ -n "$NODE_VERSION" ]; then
else
{ NVM_RC_VERSION="$(nvm_rc_version 3>&1 1>&4)"; } 4>&1 && 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
nvm_err 'nvm-exec: unable to select a node version'
# shellcheck disable=SC2016
nvm_err ' Set `NODE_VERSION` (e.g. `NODE_VERSION=default`), or add an `.nvmrc` file.'
exit 127
fi
fi