Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

node.js

npm

nexus

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!

like image 544
PH. Avatar asked Sep 17 '25 09:09

PH.


2 Answers

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.

like image 196
Klaycon Avatar answered Sep 19 '25 23:09

Klaycon


I run into exact the same issue some time ago. check at NPM if your repository team access level is read/write. On my side the team i was in had only read access level. Switching solved the issue.

like image 43
Andreas Santoro Avatar answered Sep 20 '25 00:09

Andreas Santoro