-
-
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.
nvm_install_latest_npm
: npm v5.4+ breaks on node v4-4.4 and v5-5.9,…
… due to missing `Buffer.alloc`.
- Loading branch information
Showing
1 changed file
with
10 additions
and
2 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 |
---|---|---|
|
@@ -206,8 +206,16 @@ nvm_install_latest_npm() { | |
nvm_echo '* `npm` v5 and higher do not work on `node` versions below v4.0.0' | ||
$NVM_NPM_CMD install -g npm@4 | ||
elif [ $NVM_IS_0_9 -eq 0 ] && [ $NVM_IS_0_6 -eq 0 ]; then | ||
nvm_echo '* Installing latest `npm`; if this does not work on your node version, please report a bug!' | ||
$NVM_NPM_CMD install -g npm | ||
if nvm_version_greater 4.5.0 "${NODE_VERSION}" || (\ | ||
nvm_version_greater_than_or_equal_to "${NODE_VERSION}" 5.0.0 \ | ||
&& 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] | ||
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 | ||
fi | ||
fi | ||
nvm_echo "* npm upgraded to: v$(npm --version 2>/dev/null)" | ||
} | ||
|