Compare commits

...

3 Commits

Author SHA1 Message Date
Roy Ivy III
0504fb6264
Merge cae2eb71a2d7edd13a16b86d1bc0f749b25fd290 into 6b70c40f151ca051d403453bf019e1707b33bd5b 2024-10-23 22:39:31 -05:00
Jordan Harband
6b70c40f15
[Fix] nvm_install_latest_npm: avoid unbound variable
Fixes #3447
2024-10-22 22:02:01 -07:00
Roy Ivy III
cae2eb71a2 [Fix] specify 'origin' remote name with git clone ... installs
`git` may be configured locally to use a non-'origin' default remote name.
So, specify 'origin' as the remote name when cloning to get the expected setup.
2024-05-03 00:36:04 -05:00
2 changed files with 5 additions and 3 deletions

View File

@ -163,7 +163,8 @@ install_nvm_from_git() {
} }
else else
# Cloning repo # Cloning repo
command git clone "$(nvm_source)" --depth=1 "${INSTALL_DIR}" || { command git clone "$(nvm_source)" --depth=1 -o origin "${INSTALL_DIR}" 2> /dev/null \
|| command git clone "$(nvm_source)" --depth=1 "${INSTALL_DIR}" || {
nvm_echo >&2 'Failed to clone nvm repo. Please report this!' nvm_echo >&2 'Failed to clone nvm repo. Please report this!'
exit 2 exit 2
} }

5
nvm.sh
View File

@ -196,6 +196,9 @@ nvm_install_latest_npm() {
nvm_echo 'Attempting to upgrade to the latest working version of npm...' nvm_echo 'Attempting to upgrade to the latest working version of npm...'
local NODE_VERSION local NODE_VERSION
NODE_VERSION="$(nvm_strip_iojs_prefix "$(nvm_ls_current)")" NODE_VERSION="$(nvm_strip_iojs_prefix "$(nvm_ls_current)")"
local NPM_VERSION
NPM_VERSION="$(npm --version 2>/dev/null)"
if [ "${NODE_VERSION}" = 'system' ]; then if [ "${NODE_VERSION}" = 'system' ]; then
NODE_VERSION="$(node --version)" NODE_VERSION="$(node --version)"
elif [ "${NODE_VERSION}" = 'none' ]; then elif [ "${NODE_VERSION}" = 'none' ]; then
@ -206,8 +209,6 @@ nvm_install_latest_npm() {
nvm_err 'Unable to obtain node version.' nvm_err 'Unable to obtain node version.'
return 1 return 1
fi fi
local NPM_VERSION
NPM_VERSION="$(npm --version 2>/dev/null)"
if [ -z "${NPM_VERSION}" ]; then if [ -z "${NPM_VERSION}" ]; then
nvm_err 'Unable to obtain npm version.' nvm_err 'Unable to obtain npm version.'
return 2 return 2