mirror of
https://github.com/nvm-sh/nvm.git
synced 2025-08-20 04:23:43 +00:00
Compare commits
3 Commits
52bfff4bba
...
959bc41bdb
Author | SHA1 | Date | |
---|---|---|---|
![]() |
959bc41bdb | ||
![]() |
5dc31ac51b | ||
![]() |
cbaffd8eca |
@ -349,7 +349,7 @@ In place of a version pointer like "14.7" or "16.3" or "12.22.1", you can use th
|
||||
|
||||
### Long-term Support
|
||||
|
||||
Node has a [schedule](https://github.com/nodejs/Release#release-schedule) for long-term support (LTS) You can reference LTS versions in aliases and `.nvmrc` files with the notation `lts/*` for the latest LTS, and `lts/argon` for LTS releases from the "argon" line, for example. In addition, the following commands support LTS arguments:
|
||||
Node has a [schedule](https://github.com/nodejs/Release#release-schedule) for long-term support (LTS) You can reference LTS versions in aliases and `.nvmrc` files with the notation `lts/*` for the latest _Active_ LTS, and `lts/argon` for LTS releases from the "argon" line, for example. In addition, the following commands support LTS arguments:
|
||||
|
||||
- `nvm install --lts` / `nvm install --lts=argon` / `nvm install 'lts/*'` / `nvm install lts/argon`
|
||||
- `nvm uninstall --lts` / `nvm uninstall --lts=argon` / `nvm uninstall 'lts/*'` / `nvm uninstall lts/argon`
|
||||
|
10
nvm.sh
10
nvm.sh
@ -700,10 +700,12 @@ nvm_ensure_version_installed() {
|
||||
nvm_err "N/A: version \"${PREFIXED_VERSION:-$PROVIDED_VERSION}\" is not yet installed."
|
||||
fi
|
||||
nvm_err ""
|
||||
if [ "${IS_VERSION_FROM_NVMRC}" != '1' ]; then
|
||||
nvm_err "You need to run \`nvm install ${PROVIDED_VERSION}\` to install and use it."
|
||||
else
|
||||
nvm_err 'You need to run `nvm install` to install and use the node version specified in `.nvmrc`.'
|
||||
if [ "${PROVIDED_VERSION}" = 'lts' ]; then
|
||||
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
|
||||
nvm_err "You need to run \`nvm install ${PROVIDED_VERSION}\` to install and use it."
|
||||
else
|
||||
nvm_err 'You need to run `nvm install` to install and use the node version specified in `.nvmrc`.'
|
||||
fi
|
||||
return 1
|
||||
fi
|
||||
|
19
test/slow/nvm use/Running 'nvm use lts' shows actionable error
Executable file
19
test/slow/nvm use/Running 'nvm use lts' shows actionable error
Executable file
@ -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