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

[Fix] nvm : Check if Node version is already active before switching #3546

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

adssib
Copy link

@adssib adssib commented Mar 12, 2025

Description:

This PR adds a check to ensure that nvm doesn't attempt to switch to a Node.js version if it's already the active version. If the user tries to use a version that's already active, the script will print a message and skip the redundant operation, improving efficiency and user experience.

Changes:

Added a check using nvm current to compare the currently active version with the requested version.
If the requested version is already active, it prints a message and exits without switching versions.

Issues:

Related to issue: #3545

Copy link
Member

@ljharb ljharb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This only covers nvm exec, not nvm use, and results in the user’s command not executing, which will break things. There’s also no tests included.

@ljharb ljharb marked this pull request as draft March 12, 2025 03:33
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.

2 participants