mirror of
https://github.com/nvm-sh/nvm.git
synced 2026-09-21 00:00:07 +08:00
[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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user