-
-
Notifications
You must be signed in to change notification settings - Fork 8.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[patch] give a more helpful message when lts
alias is mistakenly used
#3441
Conversation
You can (even if i wanted to accept this enhancement, it would need thorough tests) |
I understand that If we cannot modify the |
Yes, in general the error message can be improved; please do update this PR to do so instead. |
A change to the
|
nvm use lts
Command to Correctly Map to Latest LTS Versionnvm use lts
command to show better error message.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is fine, but we'll need a test for it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
9877db5
to
5dc31ac
Compare
nvm use lts
command to show better error message.lts
alias is mistakenly used
Issue
When using the command
nvm use lts
, users encounter the following error message:However, the LTS version is already installed on the system, and the command nvm use --lts works correctly. This inconsistency causes confusion and inconvenience for users who expect nvm use lts to function as intended.
Solution
The issue was identified in the
nvm_remote_version
function within thenvm.sh
script. The function did not correctly handle thelts
alias, leading to the error message.To resolve this, I modified the
nvm_remote_version
function to include a case for thelts
alias. The updated function now correctly maps thelts
alias to the latest LTS version.nvm.sh
: Added a case for "lts" to thenvm_remote_version()
function to retrieve the latest LTS version usingnvm_ls_remote
.Impact
This change ensures that the command
nvm use lts
correctly maps to the latest LTS version, providing a consistent and expected user experience. Users will no longer encounter the error message when the LTS version is already installed on their system.