Skip to content

Commit 6537c91

Browse files
authored
Fix bash auto-use nvm command
It was trying to read ./.nvmrc if you cd'ed into a subdirectory of the directory that has .nvmrc, which would give print `-bash: ./.nvmrc: No such file or directory` to stderr and potentially not doing the `nvm install`.
1 parent 07b20d5 commit 6537c91

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ cdnvm(){
462462
# If there are multiple matching versions, take the latest one
463463
# Remove the `->` and `*` characters and spaces
464464
# `locally_resolved_nvm_version` will be `N/A` if no local versions are found
465-
locally_resolved_nvm_version=$(nvm ls --no-colors $(<"./.nvmrc") | tail -1 | tr -d '\->*' | tr -d '[:space:]')
465+
locally_resolved_nvm_version=$(nvm ls --no-colors "$nvm_version" | tail -1 | tr -d '\->*' | tr -d '[:space:]')
466466

467467
# If it is not already installed, install it
468468
# `nvm install` will implicitly use the newly-installed version

0 commit comments

Comments
 (0)