Skip to content

[Fix] nvm exec: Do a version check on nvm-exec#3308

Merged
ljharb merged 1 commit intonvm-sh:masterfrom
userwiths:fork-dev
Jan 20, 2026
Merged

[Fix] nvm exec: Do a version check on nvm-exec#3308
ljharb merged 1 commit intonvm-sh:masterfrom
userwiths:fork-dev

Conversation

@userwiths
Copy link
Contributor

@userwiths userwiths commented Mar 6, 2024

This check would display a message in case the .nvmrc version is not installed, and would not alter the output otherwise.

nvm_ensure_version_installed returns the message that we care for.
It requires an argument (version) against which to do the check, which we get after calling nvm_rc_version

Fixes #1769

This check would display a message in case the `.nvmrc` version is not installed, and would not alter the output otherwise.
faeelz70

This comment was marked as spam.

@ljharb ljharb force-pushed the master branch 2 times, most recently from c6cfc3a to c20db2a Compare June 10, 2024 18:13
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 would need tests

@ljharb ljharb marked this pull request as draft July 26, 2024 23:44
@userwiths
Copy link
Contributor Author

A test case was added that checks if the message printed out contains the relevant information (different version of node).

@userwiths userwiths requested a review from ljharb July 30, 2024 08:58
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.

Thanks! (I'm going to tweak the test to be "fast" instead of "slow", and to use a "never can exist" version instead of needing to remove a version, but otherwise this is great!)

@ljharb ljharb marked this pull request as ready for review July 30, 2024 17:40
@ljharb ljharb changed the title fix: Do a version check on nvm-exec [Fix] nvm exec: Do a version check on nvm-exec Jul 30, 2024
@ljharb ljharb force-pushed the fork-dev branch 2 times, most recently from 50480e4 to 05feeaa Compare July 30, 2024 18:19
@ljharb
Copy link
Member

ljharb commented Jul 30, 2024

Unfortunately there's 10 tests failing. It's possible it's just that the expected output needs to be updated to reflect the change, but I might not have time to work on it soon, so it'd be great if you could take a look :-)

@ljharb ljharb marked this pull request as draft July 30, 2024 18:26
@userwiths
Copy link
Contributor Author

Gave it a quick look.
The issues that came from my test were related to me forgetting to remove the .nvmrc that I create during the test.

Also saw that the version color printing test was failing, and went ahead and updated it.

Currently staying on 7 errors when running in the docker container, but all other failures seem unrelated to the current changes and a bit more time consuming to debug.

@userwiths userwiths marked this pull request as ready for review July 31, 2024 14:12
@userwiths userwiths requested a review from ljharb July 31, 2024 14:12
Copy link
Member

Choose a reason for hiding this comment

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

aha, good catch. note tho that this doesn't actually restore what might already be present - we should back up and restore the existing .nvmrc in setup/teardown files

i'll take a crack at this part tho

@ljharb ljharb force-pushed the fork-dev branch 2 times, most recently from 8e1135f to 01a8749 Compare January 20, 2026 22:38
@ljharb
Copy link
Member

ljharb commented Jan 20, 2026

k, rebased this, and updated nvm-exec so it only calls nvm_rc_version when NODE_VERSION is not provided (when it is provided, nvm use ensures it's installed already)

@ljharb ljharb merged commit 01a8749 into nvm-sh:master Jan 20, 2026
172 of 174 checks passed
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 says 'no .nvmrc file found' when the problem is that the version inside of said .nvmrc is not installed.

3 participants

Comments