-
-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Fix]
install-latest-npm
: npm
v6.10
breaks on node
v6.0
, `v…
…6.1`, and `v9.0`-`v9.2`
- Loading branch information
Showing
1 changed file
with
25 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -223,13 +223,29 @@ nvm_install_latest_npm() { | |
|
||
local NVM_IS_6_OR_ABOVE | ||
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 | ||
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 | ||
|
||
local NVM_IS_9_OR_ABOVE | ||
NVM_IS_9_OR_ABOVE=0 | ||
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 | ||
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_NPM_CMD install -g [email protected] | ||
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 | ||
nvm_echo '* `npm` `v5.x` is the last version that works on `node` below `v6.0.0`' | ||
$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 [email protected] | ||
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 | ||
|