Search code examples
node.jsnpmnexus

Scoped NPM for private repository converts slash "/" to "%2F"


I would like to fetch private npm from private repository using scopes. I have set the .npmrc as such.

registry=https://registry.npmjs.org/
@myco:registry=https://nexus.myco.com/nexus/repository/

I have set the .yarnrc as such.

registry "https://registry.npmjs.org/"
"@myco:registry" "https://nexus.myco.com/nexus/repository/"

But when I do:

yarn --verbose add @myco/some-private-npm

It throws this error:

verbose 0.708 Performing "GET" request to "https://nexus.myco.com/nexus/repository/@myco%2fsome-private-npm".
verbose 0.792 Request "https://nexus.myco.com/nexus/repository/@myco%2fsome-private-npm" finished with status code 404.

When I do:

 yarn --verbose add @myco:some-private-npm

It goes to this 400 url (Nexus: Invalid repository path):

verbose 0.957 Request "https://nexus.myco.com/nexus/repository/@myco:some-private-npm" finished with status code 400.

The actual npm is located at:

https://nexus.myco.com/nexus/repository/myco/some-private-npm

How do I make sure the url fetched does not have "@" and "%2f" is a "/"?

Thanks!


Solution

  • Per this github issue for yarn, try adding similar config to your .yarnrc:

    registry "https://registry.npmjs.org/"
    "@myco:registry" "https://nexus.myco.com/nexus/repository/"
    

    Failing that, I recommend perusing the linked issue and trying the solutions provided.