[Fix] 'nvm exec' no longer prints error about '-q' being an invalid option #2800
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
the
nvm.sh
file assigns and exports anNVM_CD_FLAGS
variable if itwas sourced from a zsh shell. the fact that it's exported means that
it'll be assigned in all child processes, including the
nvm-exec
script, which uses bash as the interpreter.
Bash's
cd
command doesn't have a-q
flag, so if theNVM_CD_FLAGS
is assigned
-q
, the script will error out and incorrectly claim thatthe node version isn't installed.
this also manifests itself in the
nvm exec
command.Example:
To address this, we unset the
NVM_CD_FLAGS
at the start of thenvm-exec
script, before loadingnvm.sh
.