registries with non-root URLs broken

Related to [this change](https://github.com/npm/npm/commit/626c3e4a7fb37159b79ab9b3af2c030f26540b0f), with  further explanation in [this thread](https://github.com/npm/npm/commit/626c3e4a7fb37159b79ab9b3af2c030f26540b0f#commitcomment-6856870).