Compare commits

...

3 Commits

Author SHA1 Message Date
Michael
6688647757
Merge 477353e1a48a64912b4e2dc2cce9c6784ed82ab5 into 6b70c40f151ca051d403453bf019e1707b33bd5b 2024-10-24 09:37:13 +02:00
Jordan Harband
6b70c40f15
[Fix] nvm_install_latest_npm: avoid unbound variable
Fixes #3447
2024-10-22 22:02:01 -07:00
Michael Zanggl
477353e1a4 add ARCH overwrite 2023-12-20 15:40:28 +09:00

10
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
@ -2046,6 +2047,11 @@ nvm_get_arch() {
local EXIT_CODE local EXIT_CODE
local LONG_BIT local LONG_BIT
if [ -n "$NVM_NODEJS_ORG_ARCH" ]; then
nvm_echo "${NVM_NODEJS_ORG_ARCH}"
return
fi
NVM_OS="$(nvm_get_os)" NVM_OS="$(nvm_get_os)"
# If the OS is SunOS, first try to use pkgsrc to guess # If the OS is SunOS, first try to use pkgsrc to guess
# the most appropriate arch. If it's not available, use # the most appropriate arch. If it's not available, use