Skip to content
Myr

[Fix] `nvm install-latest-npm`: ensure npm 9 does not install on unsupported nodes

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Jordan Harband · committed by Jordan Harband · parent 5e9791c · Browse files · 1 file+28 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+28 added−0 removed

  • other:+28 added−0 removed

1 file+28 added−0 removed

modified:nvm.sh+28 added
281 unmodified lines
282 NVM_IS_14_LTS_OR_ABOVE=0283 if [ $NVM_IS_13_OR_ABOVE -eq 1 ] && nvm_version_greater_than_or_equal_to "${NODE_VERSION}" 14.15.0; then284 NVM_IS_14_LTS_OR_ABOVE=1285 fi286 local NVM_IS_14_17_OR_ABOVE287 NVM_IS_14_17_OR_ABOVE=0288 if [ $NVM_IS_14_LTS_OR_ABOVE -eq 1 ] && nvm_version_greater_than_or_equal_to "${NODE_VERSION}" 14.17.0; then289 NVM_IS_14_17_OR_ABOVE=1290 fi291 local NVM_IS_15_OR_ABOVE292 NVM_IS_15_OR_ABOVE=0293 if [ $NVM_IS_14_LTS_OR_ABOVE -eq 1 ] && nvm_version_greater_than_or_equal_to "${NODE_VERSION}" 15.0.0; then294 NVM_IS_15_OR_ABOVE=1
2 unmodified lines
297 NVM_IS_16_OR_ABOVE=0298 if [ $NVM_IS_15_OR_ABOVE -eq 1 ] && nvm_version_greater_than_or_equal_to "${NODE_VERSION}" 16.0.0; then299 NVM_IS_16_OR_ABOVE=1300 fi301 local NVM_IS_16_LTS_OR_ABOVE302 NVM_IS_16_LTS_OR_ABOVE=0303 if [ $NVM_IS_16_OR_ABOVE -eq 1 ] && nvm_version_greater_than_or_equal_to "${NODE_VERSION}" 16.13.0; then304 NVM_IS_16_LTS_OR_ABOVE=1305 fi306 local NVM_IS_17_OR_ABOVE307 NVM_IS_17_OR_ABOVE=0308 if [ $NVM_IS_16_LTS_OR_ABOVE -eq 1 ] && nvm_version_greater_than_or_equal_to "${NODE_VERSION}" 17.0.0; then309 NVM_IS_17_OR_ABOVE=1310 fi311 local NVM_IS_18_OR_ABOVE312 NVM_IS_18_OR_ABOVE=0313 if [ $NVM_IS_17_OR_ABOVE -eq 1 ] && nvm_version_greater_than_or_equal_to "${NODE_VERSION}" 18.0.0; then314 NVM_IS_18_OR_ABOVE=1315 fi316317 if [ $NVM_IS_4_4_OR_BELOW -eq 1 ] || {318 [ $NVM_IS_5_OR_ABOVE -eq 1 ] && nvm_version_greater 5.10.0 "${NODE_VERSION}"; \319 }; then
20 unmodified lines
340 || { [ $NVM_IS_15_OR_ABOVE -eq 1 ] && [ $NVM_IS_16_OR_ABOVE -eq 0 ]; } \341 ; then342 nvm_echo '* `npm` `v7.x` is the last version that works on `node` `v13`, `v15`, below `v12.13`, or `v14.0` - `v14.15`'343 $NVM_NPM_CMD install -g npm@7344 elif \345 { [ $NVM_IS_12_LTS_OR_ABOVE -eq 1 ] && [ $NVM_IS_13_OR_ABOVE -eq 0 ]; } \346 || { [ $NVM_IS_14_LTS_OR_ABOVE -eq 1 ] && [ $NVM_IS_14_17_OR_ABOVE -eq 0 ]; } \347 || { [ $NVM_IS_16_OR_ABOVE -eq 1 ] && [ $NVM_IS_16_LTS_OR_ABOVE -eq 0 ]; } \348 || { [ $NVM_IS_17_OR_ABOVE -eq 1 ] && [ $NVM_IS_18_OR_ABOVE -eq 0 ]; } \349 ; then350 nvm_echo '* `npm` `v8.x` is the last version that works on `node` `v12`, `v14.13` - `v14.16`, or `v16.0` - `v16.12`'351 $NVM_NPM_CMD install -g npm@8352 else353 nvm_echo '* Installing latest `npm`; if this does not work on your node version, please report a bug!'354 $NVM_NPM_CMD install -g npm355 fi
4042 unmodified lines