#!/usr/bin/env sh

set -o nounset
set -o errexit

npm install semver
if node -e "process.exit(require('semver').lt(process.argv[1], '1.3.7') ? 0 : 1)" $(npm -v); then
  npm install -g npm@'>= 1.3.7'
fi
npm uninstall semver

#!/usr/bin/env sh

set -o nounset
set -o errexit

npm install semver
if node -e "process.exit(require('semver').lt(process.argv[1], '1.3.7') ? 0 : 1)" $(npm -v); then
  npm install -g npm@2
  npm install -g npm
fi
npm uninstall semver

Fix node 0.8 blowing up upgrading npm 1 -> 3
Fix node 0.8 blowing up upgrading npm 1 -> 3

Relevant: https://github.com/npm/npm/issues/9668