Skip to content
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

nvm should check for the current npm version when resetting #3545

Open
adssib opened this issue Mar 12, 2025 · 6 comments
Open

nvm should check for the current npm version when resetting #3545

adssib opened this issue Mar 12, 2025 · 6 comments

Comments

@adssib
Copy link

adssib commented Mar 12, 2025

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:

  1. The user switches to a Node version using:
   nvm use 20.18.11
  1. 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.
@ljharb
Copy link
Member

ljharb commented Mar 12, 2025

In what way does it not already work like this?

@ljharb
Copy link
Member

ljharb commented Mar 12, 2025

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.

@adssib
Copy link
Author

adssib commented Mar 12, 2025

I only used LLM in the bug report

@adssib
Copy link
Author

adssib commented Mar 12, 2025

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

@ljharb
Copy link
Member

ljharb commented Mar 12, 2025

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.

@adssib
Copy link
Author

adssib commented Mar 12, 2025

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.

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

No branches or pull requests

2 participants