Put all the global npm-install detection in one place. Fixes #194

@dpup