mirror of
https://github.com/nvm-sh/nvm.git
synced 2025-05-10 14:21:50 +00:00
[Fix] nvm_print_npm_version
: if npm
exists but its node crashes, do not print the npm version
This commit is contained in:
parent
a07cd41af1
commit
c08b38a2a4
6
nvm.sh
6
nvm.sh
@ -163,7 +163,11 @@ nvm_is_version_installed() {
|
|||||||
|
|
||||||
nvm_print_npm_version() {
|
nvm_print_npm_version() {
|
||||||
if nvm_has "npm"; then
|
if nvm_has "npm"; then
|
||||||
command printf " (npm v$(npm --version 2>/dev/null))"
|
local NPM_VERSION
|
||||||
|
NPM_VERSION="$(npm --version 2>/dev/null)"
|
||||||
|
if [ -n "${NPM_VERSION}" ]; then
|
||||||
|
command printf " (npm v${NPM_VERSION})"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user