[Fix] `latest-npm`: ensure npm 7 is not installed on node < 10
parent
6110d31969
commit
c7ca08d575
9
nvm.sh
9
nvm.sh
|
@ -243,6 +243,12 @@ nvm_install_latest_npm() {
|
|||
fi
|
||||
fi
|
||||
|
||||
local NVM_IS_10_OR_ABOVE
|
||||
NVM_IS_10_OR_ABOVE=0
|
||||
if [ $NVM_IS_9_3_OR_ABOVE -eq 1 ] && nvm_version_greater_than_or_equal_to "${NODE_VERSION}" 10.0.0; then
|
||||
NVM_IS_10_OR_ABOVE=1
|
||||
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
|
||||
|
@ -260,6 +266,9 @@ nvm_install_latest_npm() {
|
|||
; 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
|
||||
elif [ $NVM_IS_10_OR_ABOVE -eq 0 ]; then
|
||||
nvm_echo '* `npm` `v6.x` is the last version that works on `node` below `v10.0.0`'
|
||||
$NVM_NPM_CMD install -g npm@6
|
||||
else
|
||||
nvm_echo '* Installing latest `npm`; if this does not work on your node version, please report a bug!'
|
||||
$NVM_NPM_CMD install -g npm
|
||||
|
|
Loading…
Reference in New Issue