-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Yarn doesn't read from .npmrc Files for custom registry settings #606
Comments
I wonder, so Facebook doesn't have internal registry for private stuff? Or it's just not yet implemented for open source? |
Even worse - it uses the yarn registry config when asked to fetch from npm: class NpmRegistry extends (_baseRegistry || _load_baseRegistry()).default {
/* ... */
request(pathname) {
// ...
- const registry = (0, (_misc || _load_misc()).removeSuffix)(String(this.registries.yarn.getOption('registry')), '/');
+ const registry = (0, (_misc || _load_misc()).removeSuffix)(String(this.registries.npm.getOption('registry')), '/'); |
Hey everyone, please use the upvote button on GitHub so we can keep this issue from turning into 1000 comments |
Workaround - put the following into a
|
@jkrems What is the syntax for scoped registries?
throws an |
@tyrsius It's a custom file format ( |
Would be awesome if yarn can address this issue as I work with internal registry daily. |
Anyone figured out yet how to configure |
Complete blocker to using this tool. Changed the registry in yarn config (because "drop in replacement for npm"!! 🤔), |
This is a blocker to Airbnb using yarn - just like yarn uses package.json, it should also use every other npm configuration method ( |
I tested putting:
in my projects yarnrc, it does not appear to work |
For registries requiring auth, some work might be needed as well. For example, our
Couldn't find a way to make a |
I have the same issue |
If a yarnrc is required for anything, then yarn is not a drop in replacement for npm |
I'm trying to use with npm support on Sonatype Nexus 2.11.3-01, I just get this, with a .yarnrc file as first described above:
|
We can not replace bower (at least not without some hacks) until the issue [1] is solved. Also note, that as of today private registries requiring authentication can not be used [2] [3]. [1] yarnpkg/yarn#617 (comment) [2] yarnpkg/yarn#606 [3] yarnpkg/yarn#547
If your custom registry requires a trailing slash, yarn is stripping it. rectify this by appending your registry url with a double slash i.e. Appears to be related to this line yarn/src/registries/npm-registry.js Line 50 in 0f1db96
|
@arcticShadow that fixed both issues for me, scoped registry is working now. However, this appears to make the setting global, ignoring the |
Indeed it does. Couple of options:
I'd like to point out, though, given that the .yarnrc file was already mentioned, and the double slash trick has been mentioned, I thought you would have been able to connect the dots on that one your-self. Perhaps bleeding edge tech is not your thing? |
@arcticShadow You misunderstand: putting it in the There is no need to be rude. |
My apologies - I missed your edit clarifying the behaviour. |
Further digging in the registry code shows that the global If your local .yarnrc is being ignored, perhaps try checking the syntax? it can be copied out of the |
I tried that, it didn't work. Does it work for you? |
Not sure what to say - Works on my machine (tm) I've tested this by putting a completely fake URL in my I've also tested with no registry in
I have not tested this with scoped packages though... |
Yea, it looks like the scoped package resolution is not working. Perhaps I am just not specifying it correctly.
|
In my case, I keep
·.yarnrc` file:
Keep registry field in both file same and it works. |
is that an intentional space preceding your registry? Any reason for that? |
@arcticShadow No. It's a typo. I have fixed that. |
This only works for me with Nexus and HTTP basic auth by specifying user and password as part of the URL:
Seems like the |
@bripkens I think my problem is the same as yours |
I tried all kind of setting the custom repo and it keeps failing with ECONNRESET:
My current .yarnrc is
Btw yarn hangs if there's no '\n' in the end. |
I can confirm Now I need to know how to do with News? |
Thank everyone for the comments. I'll have a patch out later today to fix this 😄 |
Created #871 to fix this, pending approval. |
With an .npmrc file like below:
It seems yarn will not respect this and try the normal NPM upstream.
The text was updated successfully, but these errors were encountered: