mirror of
https://github.com/nvm-sh/nvm.git
synced 2026-09-13 00:01:21 +08:00
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
23 lines
610 B
Bash
Executable File
23 lines
610 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
DIR="$(command cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
|
|
unset NVM_CD_FLAGS
|
|
|
|
# shellcheck disable=SC1090,SC1091
|
|
\. "$DIR/nvm.sh" --no-use
|
|
|
|
if [ -n "$NODE_VERSION" ]; then
|
|
nvm use "$NODE_VERSION" > /dev/null || exit 127
|
|
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
|
|
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
|
|
|
|
exec "$@"
|