jspm / npm

NPM Location Service
19 stars 34 forks source link

jspm ignores the port of a scoped npm registry #167

Closed Wanderduene closed 6 years ago

Wanderduene commented 7 years ago

Hi,

I have a jspm project, wich is using two different npm registries. A global registry (in our internal network) and a local registry (running on an nexus server on my local machine) for some scoped packages. Nexus server was running on port 9081.

My .npmrc looked like this:

registry=https://our.internal.registry.net/
_auth=ourregistrykey
always-auth=true
strict-ssl=false
proxy=http://proxy-of-our-company.net:3128/
https-proxy=http://proxy-of-our-company.net:3128

@myscope:registry=http://my-machine.our.company.net:9081/repository/npm_private/
//my-machine.our.company.net:9081/repository/npm_private/:_auth=myregistrykey

Every time I tried to install a package from "myscope" via jspm, I got an authentication error. When I tried it with pure npm, it worked perfectly.

We figured out, that the problem was the port number from the URL of the scoped registry. After changing the nexus server to start on port 80 and updating the scoped registry in the .npmrc to

@myscope:registry=http://my-machine.our.company.net/repository/npm_private/
//my-machine.our.company.net/repository/npm_private/:_auth=myregistrykey

everything worked fine.

I would expect that jspm respects the port part of a registry URL like npm does.

My jspm version: 0.17.0-beta.42 My npm version: 5.3.0 My node version: 8.2.1 My machine: Windows 7 Enterprise 64bit

guybedford commented 7 years ago

Thanks for reporting this. I've added a possible fix here in https://github.com/jspm/npm/commit/fe417476e5ca1492621dd7303ca7611701be9190.

Do you think you could test that out and see if it works for you?

If not it would help a lot to know if the authentication error happens during the locate or the download operation.

Wanderduene commented 7 years ago

I'll check it out on monday. Thanks :)

goatrocks commented 6 years ago

I am running up against what I am almost positive is this very issue, any idea if this fix worked? If it hasn't been tried I can also give it a shot myself!

editing to add that I tried it, but then realized the error is on lookup not on download (so it's the locate operating?), specifically the error is:

warn Error on lookup for npm:@{scope}/{package-name} Invalid authentication details. Run jspm registry config npm to reconfigure.

guybedford commented 6 years ago

Fixed in #171, thanks to @meggle.

Will post the release out shortly.