[Fix] `install-latest-npm`: `npm` `v6.10` breaks on `node` `v6.0`, `v6.1`, and `v9.0`-`v9.2`
parent
1eca354233
commit
100861d529
28
nvm.sh
28
nvm.sh
|
@ -223,13 +223,29 @@ nvm_install_latest_npm() {
|
||||||
|
|
||||||
local NVM_IS_6_OR_ABOVE
|
local NVM_IS_6_OR_ABOVE
|
||||||
NVM_IS_6_OR_ABOVE=0
|
NVM_IS_6_OR_ABOVE=0
|
||||||
|
local NVM_IS_6_2_OR_ABOVE
|
||||||
|
NVM_IS_6_2_OR_ABOVE=0
|
||||||
if [ $NVM_IS_5_OR_ABOVE -eq 1 ] && nvm_version_greater_than_or_equal_to "${NODE_VERSION}" 6.0.0; then
|
if [ $NVM_IS_5_OR_ABOVE -eq 1 ] && nvm_version_greater_than_or_equal_to "${NODE_VERSION}" 6.0.0; then
|
||||||
NVM_IS_6_OR_ABOVE=1
|
NVM_IS_6_OR_ABOVE=1
|
||||||
|
if nvm_version_greater_than_or_equal_to "${NODE_VERSION}" 6.2.0; then
|
||||||
|
NVM_IS_6_2_OR_ABOVE=1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $NVM_IS_4_4_OR_BELOW -eq 1 ] || (\
|
local NVM_IS_9_OR_ABOVE
|
||||||
[ $NVM_IS_5_OR_ABOVE -eq 1 ] && nvm_version_greater 5.10.0 "${NODE_VERSION}" \
|
NVM_IS_9_OR_ABOVE=0
|
||||||
); then
|
local NVM_IS_9_3_OR_ABOVE
|
||||||
|
NVM_IS_9_3_OR_ABOVE=0
|
||||||
|
if [ $NVM_IS_6_2_OR_ABOVE -eq 1 ] && nvm_version_greater_than_or_equal_to "${NODE_VERSION}" 9.0.0; then
|
||||||
|
NVM_IS_9_OR_ABOVE=1
|
||||||
|
if nvm_version_greater_than_or_equal_to "${NODE_VERSION}" 9.3.0; then
|
||||||
|
NVM_IS_9_3_OR_ABOVE=1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $NVM_IS_4_4_OR_BELOW -eq 1 ] || {
|
||||||
|
[ $NVM_IS_5_OR_ABOVE -eq 1 ] && nvm_version_greater 5.10.0 "${NODE_VERSION}"; \
|
||||||
|
}; then
|
||||||
nvm_echo '* `npm` `v5.3.x` is the last version that works on `node` 4.x versions below v4.4, or 5.x versions below v5.10, due to `Buffer.alloc`'
|
nvm_echo '* `npm` `v5.3.x` is the last version that works on `node` 4.x versions below v4.4, or 5.x versions below v5.10, due to `Buffer.alloc`'
|
||||||
$NVM_NPM_CMD install -g npm@5.3
|
$NVM_NPM_CMD install -g npm@5.3
|
||||||
elif [ $NVM_IS_4_4_OR_BELOW -eq 0 ] && nvm_version_greater 4.7.0 "${NODE_VERSION}"; then
|
elif [ $NVM_IS_4_4_OR_BELOW -eq 0 ] && nvm_version_greater 4.7.0 "${NODE_VERSION}"; then
|
||||||
|
@ -238,6 +254,12 @@ nvm_install_latest_npm() {
|
||||||
elif [ $NVM_IS_6_OR_ABOVE -eq 0 ]; then
|
elif [ $NVM_IS_6_OR_ABOVE -eq 0 ]; then
|
||||||
nvm_echo '* `npm` `v5.x` is the last version that works on `node` below `v6.0.0`'
|
nvm_echo '* `npm` `v5.x` is the last version that works on `node` below `v6.0.0`'
|
||||||
$NVM_NPM_CMD install -g npm@5
|
$NVM_NPM_CMD install -g npm@5
|
||||||
|
elif \
|
||||||
|
{ [ $NVM_IS_6_OR_ABOVE -eq 1 ] && [ $NVM_IS_6_2_OR_ABOVE -eq 0 ]; } \
|
||||||
|
|| { [ $NVM_IS_9_OR_ABOVE -eq 1 ] && [ $NVM_IS_9_3_OR_ABOVE -eq 0 ]; } \
|
||||||
|
; then
|
||||||
|
nvm_echo '* `npm` `v6.9` is the last version that works on `node` `v6.0.x`, `v6.1.x`, `v9.0.x`, `v9.1.x`, or `v9.2.x`'
|
||||||
|
$NVM_NPM_CMD install -g npm@6.9
|
||||||
else
|
else
|
||||||
nvm_echo '* Installing latest `npm`; if this does not work on your node version, please report a bug!'
|
nvm_echo '* Installing latest `npm`; if this does not work on your node version, please report a bug!'
|
||||||
$NVM_NPM_CMD install -g npm
|
$NVM_NPM_CMD install -g npm
|
||||||
|
|
Loading…
Reference in New Issue