mirror of
https://github.com/nvm-sh/nvm.git
synced 2025-08-20 04:23:43 +00:00
Compare commits
5 Commits
a4c84c2104
...
dcc618006b
Author | SHA1 | Date | |
---|---|---|---|
![]() |
dcc618006b | ||
![]() |
70afc73fa5 | ||
![]() |
68fe9f1b80 | ||
![]() |
d8d653147c | ||
![]() |
0ad41dd1c2 |
2
nvm.sh
2
nvm.sh
@ -701,7 +701,7 @@ nvm_ensure_version_installed() {
|
|||||||
fi
|
fi
|
||||||
nvm_err ""
|
nvm_err ""
|
||||||
if [ "${PROVIDED_VERSION}" = 'lts' ]; then
|
if [ "${PROVIDED_VERSION}" = 'lts' ]; then
|
||||||
nvm_err "You need to run \`nvm install --lts\` to install and \`nvm use --lts\` to use it."
|
nvm_err "`lts` is not an alias - you may need to run \`nvm install --lts\` to install and \`nvm use --lts\` to use it."
|
||||||
elif [ "${IS_VERSION_FROM_NVMRC}" != '1' ]; then
|
elif [ "${IS_VERSION_FROM_NVMRC}" != '1' ]; then
|
||||||
nvm_err "You need to run \`nvm install ${PROVIDED_VERSION}\` to install and use it."
|
nvm_err "You need to run \`nvm install ${PROVIDED_VERSION}\` to install and use it."
|
||||||
else
|
else
|
||||||
|
@ -0,0 +1,19 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -ex
|
||||||
|
|
||||||
|
die () { echo "$@" ; exit 1; }
|
||||||
|
|
||||||
|
\. ../../../nvm.sh
|
||||||
|
|
||||||
|
# Deactivate any active node version
|
||||||
|
nvm deactivate >/dev/null 2>&1 || die 'deactivate failed'
|
||||||
|
|
||||||
|
# Attempt to use 'lts' without '--' and capture the error message
|
||||||
|
ERROR_OUTPUT=$(nvm use lts 2>&1) || true
|
||||||
|
|
||||||
|
EXPECTED_ERROR="`lts` is not an alias - you may need to run \`nvm install --lts\` to install and \`nvm use --lts\` to use it."
|
||||||
|
|
||||||
|
# Check if the error message matches the expected output
|
||||||
|
echo "$ERROR_OUTPUT" | grep -q "$EXPECTED_ERROR" \
|
||||||
|
|| die "Expected error message not found. Got: $ERROR_OUTPUT"
|
Loading…
x
Reference in New Issue
Block a user