Skip to content

Conversation

@Rahulbeniwal26119
Copy link

Problem

Users could run nvm install Argon (or any LTS codename) and it would install successfully, but nvm uninstall Argon would fail with "N/A version is not installed". This inconsistency was confusing.
Root Cause: nvm_ls_remote uses grep which matches "Argon" in the description v4.9.1 (Latest LTS: Argon), not just the version number.

Solution

Added verification in nvm_remote_version to check if the search pattern actually exists in the version number (not just the description).

Changes

  • nvm.sh (lines 785-791): Added pattern verification logic
  • test/fast/Unit tests/nvm_remote_version: Added tests for LTS name rejection

Behavior Changes

Command Before After
nvm install Argon ✅ Installs v4.9.1 ❌ Fails: "Version 'Argon' not found"
nvm uninstall Argon ❌ Fails ❌ Fails (consistent now)
nvm install lts/argon ✅ Works ✅ Works
nvm install 4 ✅ Works ✅ Works
nvm install node ✅ Works ✅ Works

Testing

Previously, `nvm install Argon` would succeed by matching the LTS name
in the version description (e.g., "v4.9.1 (Latest LTS: Argon)"), but
`nvm uninstall Argon` would fail because "Argon" is not a valid alias or not a valid version.

Changes:
- Added pattern matching check in nvm_remote_version (nvm.sh:785-791)
- Skips check for implicit aliases (node, stable, etc.) to preserve
  existing functionality
- Added unit tests to verify LTS names are rejected while version
  numbers still work
After this fix:
- `nvm install Argon` → fails (use `nvm install lts/argon` instead)
- `nvm install 4` → still works
- `nvm install node` → still works
- `nvm install lts/argon` → still works
This makes install and uninstall behavior consistent.
animalbullram-commits

This comment was marked as spam.

@Rahulbeniwal26119

This comment was marked as off-topic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

nvm install Argon etc works, and should not

2 participants