Compare commits

...

3 Commits

Author SHA1 Message Date
Hasham
6718e17471
Merge 510d152ee5678cbff4a3f0f55b9ed2ad699b7c55 into 6b70c40f151ca051d403453bf019e1707b33bd5b 2024-10-29 09:49:19 +01:00
Jordan Harband
6b70c40f15
[Fix] nvm_install_latest_npm: avoid unbound variable
Fixes #3447
2024-10-22 22:02:01 -07:00
hasham7861
510d152ee5 [Tag]: removing cdnvm command in readme for bashrc file
There is an uncessary `cdnvm "$PWD" || exit` taking place and not all the systems that have bash come with it, so its uncessary
2023-11-16 19:59:15 -05:00
2 changed files with 4 additions and 3 deletions

View File

@ -646,7 +646,7 @@ cdnvm() {
}
alias cd='cdnvm'
cdnvm "$PWD" || exit
```
This alias would search 'up' from your current directory in order to detect a `.nvmrc` file. If it finds it, it will switch to that version; if not, it will use the default version.

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...'
local NODE_VERSION
NODE_VERSION="$(nvm_strip_iojs_prefix "$(nvm_ls_current)")"
local NPM_VERSION
NPM_VERSION="$(npm --version 2>/dev/null)"
if [ "${NODE_VERSION}" = 'system' ]; then
NODE_VERSION="$(node --version)"
elif [ "${NODE_VERSION}" = 'none' ]; then
@ -206,8 +209,6 @@ nvm_install_latest_npm() {
nvm_err 'Unable to obtain node version.'
return 1
fi
local NPM_VERSION
NPM_VERSION="$(npm --version 2>/dev/null)"
if [ -z "${NPM_VERSION}" ]; then
nvm_err 'Unable to obtain npm version.'
return 2