Fix a bug installing local packages globally with npm

When specifying a local package with `path` and `global`, the check for
whether that package was missing would always return false. Because the `npm
list` command was run with the `--global` switch, the missing packages would
never contain the local package since there is no way for npm to know about it.

 In order to see whether a local package is or isn't installed locally, we must
do an `npm list` *without* the global flag inside the local package, then
explicity add it to the list of globally missing packages.

This fixes #5204