install: support `npm`s lower than v2

master
elliottcable 2015-02-07 21:12:46 -06:00
parent a216f56443
commit ea4264645b
1 changed files with 2 additions and 2 deletions

View File

@ -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')"