Skip to content

Commit 99352a6

Browse files
todeveniljharb
authored andcommitted
[Fix] nvm_install_latest_npm: fix node version detection
1 parent ffec9fe commit 99352a6

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

nvm.sh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -356,19 +356,19 @@ nvm_install_latest_npm() {
356356
if [ $NVM_IS_19_OR_ABOVE -eq 1 ] && nvm_version_greater_than_or_equal_to "${NODE_VERSION}" 20.5.0; then
357357
NVM_IS_20_5_OR_ABOVE=1
358358
fi
359-
local NVM_IS_20_17_or_ABOVE
360-
NVM_IS_20_17_or_ABOVE=0
361-
if [ $NVM_IS_20_5_OR_ABOVE -eq 1 ] && nvm_version_greater 20.17.0 "${NODE_VERSION}"; then
362-
NVM_IS_20_17_or_ABOVE=1
359+
local NVM_IS_20_17_OR_ABOVE
360+
NVM_IS_20_17_OR_ABOVE=0
361+
if [ $NVM_IS_20_5_OR_ABOVE -eq 1 ] && nvm_version_greater_than_or_equal_to "${NODE_VERSION}" 20.17.0; then
362+
NVM_IS_20_17_OR_ABOVE=1
363363
fi
364364
local NVM_IS_21_OR_ABOVE
365365
NVM_IS_21_OR_ABOVE=0
366-
if [ $NVM_IS_20_17_or_ABOVE -eq 1 ] && nvm_version_greater 21.0.0 "${NODE_VERSION}"; then
366+
if [ $NVM_IS_20_17_OR_ABOVE -eq 1 ] && nvm_version_greater_than_or_equal_to "${NODE_VERSION}" 21.0.0; then
367367
NVM_IS_21_OR_ABOVE=1
368368
fi
369369
local NVM_IS_22_9_OR_ABOVE
370370
NVM_IS_22_9_OR_ABOVE=0
371-
if [ $NVM_IS_21_OR_ABOVE -eq 1 ] && nvm_version_greater 22.9.0 "${NODE_VERSION}"; then
371+
if [ $NVM_IS_21_OR_ABOVE -eq 1 ] && nvm_version_greater_than_or_equal_to "${NODE_VERSION}" 22.9.0; then
372372
NVM_IS_22_9_OR_ABOVE=1
373373
fi
374374

@@ -420,7 +420,7 @@ nvm_install_latest_npm() {
420420
nvm_echo '* `npm` `v9.x` is the last version that works on `node` `< v18.17`, `v19`, or `v20.0` - `v20.4`'
421421
$NVM_NPM_CMD install -g npm@9
422422
elif \
423-
[ $NVM_IS_20_17_or_ABOVE -eq 0 ] \
423+
[ $NVM_IS_20_17_OR_ABOVE -eq 0 ] \
424424
|| { [ $NVM_IS_21_OR_ABOVE -eq 1 ] && [ $NVM_IS_22_9_OR_ABOVE -eq 0 ]; } \
425425
; then
426426
nvm_echo '* `npm` `v10.x` is the last version that works on `node` `< v20.17`, `v21`, or `v22.0` - `v22.8`'

0 commit comments

Comments
 (0)