nvm
nvm copied to clipboard
nvm should check for the current npm version when resetting
Suggested Improvement for nvm: Prevent Redundant Node Version Switches
It would be helpful for nvm to perform a check when the user attempts to "reset" the Node version that is already active. This would prevent redundant operations and improve the overall user experience.
Example:
- The user switches to a Node version using:
nvm use 20.18.11
- If the user attempts to run the same command again, instead of repeating the process, nvm should notify the user that the version is already active.
Error: Node.js version 20.18.11 is already active.
In what way does it not already work like this?
Can you also confirm you’re not using any LLM? LLM-based contributions aren’t clearly legally permitted in an open source project due to licensing provenance concerns.
I only used LLM in the bug report
In what way does it not already work like this?
No it does not check the current version
if you do the same command twice it will re do the whole process again
it does not throw the error thats for sure what happens
It shouldn’t throw an error - the user asked for a command to be run in a version, so that’s what should happen. It’s a reasonable optimization to noop the “use” if that version is already in use, though.
It shouldn’t throw an error - the user asked for a command to be run in a version, so that’s what should happen. It’s a reasonable optimization to noop the “use” if that version is already in use, though.
Yeah thats my intention to add a logic that will check if the user requested version is currently used
this will help with avoiding unnecessary switching of versions
My intention was just to add a check that will see if the requested versions is actually right now set
if so display a message, call an error or whatever
If you're interested in having this feature added to the tool, let me know, and I'd be happy to continue working on it.