mirror of
https://github.com/nvm-sh/nvm.git
synced 2025-12-17 18:54:21 +08:00
install: support npms lower than v2
This commit is contained in:
@@ -150,9 +150,9 @@ nvm_check_global_modules() {
|
|||||||
|
|
||||||
local NPM_VERSION
|
local NPM_VERSION
|
||||||
NPM_VERSION="$(npm --version)"
|
NPM_VERSION="$(npm --version)"
|
||||||
NPM_VERSION="${NPM_VERSION:-0}"
|
NPM_VERSION="${NPM_VERSION:--1}"
|
||||||
[ "$NVM_DEBUG" = 0 ] && debug "NPM detected (at version ${NPM_VERSION}.)"
|
[ "$NVM_DEBUG" = 0 ] && debug "NPM detected (at version ${NPM_VERSION}.)"
|
||||||
[ "${NPM_VERSION%%[!0-9]*}" -gt 1 ] || return 0
|
[ "${NPM_VERSION%%[!0-9]*}" -gt 0 ] || return 0
|
||||||
|
|
||||||
local NPM_GLOBAL_MODULES
|
local NPM_GLOBAL_MODULES
|
||||||
NPM_GLOBAL_MODULES="$(npm list -g --depth=0 | sed '/ npm@/d')"
|
NPM_GLOBAL_MODULES="$(npm list -g --depth=0 | sed '/ npm@/d')"
|
||||||
|
|||||||
Reference in New Issue
Block a user