-
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
Can't install from private scoped registries #4366
Comments
Not sure how to best fix this yet, because I don't quite understand what the PR was trying to fix or why the regex was changed. |
The thing is, per #4027 (comment), Can you give more details about your private server to help us resolve the issue? |
You can try and see it yourself too: |
I'm having the same issues with private scoped packages hosted on npmjs.com. Reverting back to 0.27.5 fixes this. Example: https://www.npmjs.com/package/@settlemint/lib-ethereum |
The private registry implementation I'm using is https://github.com/cnpm/cnpmjs.org. We've been using it with yarn ever since the scoped package support was added in yarn. It broke with 1.0.0. But even today scoped packages in both cnpm and official npm registry have slashes in the tarball urls. Example 1 - https://registry.npmjs.org/@std%2fesm Example 2 - http://registry.cnpmjs.org/@alibaba.ir/babel-preset-alibaba Example 3 - https://registry.yarnpkg.com/@npm%2fdecorate |
@KidkArolis - thanks a lot for the clarification! I'm just very confused about this inconsistent behavior but I'll see if I can fix this clearly. |
Yep so this is my fault, sorry everyone. It seems that the url to get the package details have the package name escaped, but in the tarball url they are not. |
Confirming - private packages installation is broken on |
@lukeggchapman thanks for the updates! @KidkArolis are you using the same NPM registry? If so, looks like that project is at fault here. Setting Alternatively, |
@lukeggchapman is using verdaccio, I'm using cnpmjs. If that's what you mean. But this is an issue with the official npm registry too! I don't see this as a bug in any of the registries. As in, that's how npm official registry always worked and so I don't think yarn should break that compatibility. In fact - my guess is that the current version of yarn does not work with private npm packages in the official npm registry (not just these open source registries). I haven't verified that, because I don't have a private npm account myself, but judging by those I'm a little puzzled by the fact that npm no longer supports URL like https://registry.npmjs.org/@std/esm with slashes, I thought it used to support both (which isn't necessarily a good thing. To complicate matters further, the |
I can confirm issue is with official npm registry too. See #4387 (comment) comment with log. Same issue with both v0.28 and v1. |
A workaround for 1.0 until there is a fix would be to If this is an issue with just a scoped registry then you can set it to true just for that registry in your
|
I'm all for supporting both, as it solves my use case. Eg:
That being said, I don't see any harm in supporting both, the |
If someone wants to revert, for us, adding |
**Summary** Fixes #4366. NPM registry encodes the `/` in scoped package names for meta look ups but not for tarball download URLs so Yarn was not sending authentication headers for the tarball downloads breaking scoped packages. This patch fixes it. **Test plan** Updated tests.
I have the same issue, after upgrading yarn from 0.27.5 to 1.0.2 i get |
@arutkowski00 this issue was closed and I think you are experiencing #4451 so I suggest following that. |
…4367) **Summary** Fixes yarnpkg#4366. NPM registry encodes the `/` in scoped package names for meta look ups but not for tarball download URLs so Yarn was not sending authentication headers for the tarball downloads breaking scoped packages. This patch fixes it. **Test plan** Updated tests.
Do you want to request a feature or report a bug?
This is a regression in 1.0.0.
Explanation
This regex
const SCOPED_PKG_REGEXP = /(?:^|\/)(@[^\/?]+?)(?=%2f)/
:https://github.com/yarnpkg/yarn/blob/master/src/registries/npm-registry.js#L30
introduced in this commit:
cbb27f4
or this PR:
#4027
completely breaks support for private npm registries.
The
request
function is sometimes called with a package name (@my/pkg
) and sometimes with a full URL (https://myregistry.dev/@my/pkg/download/@my/pkg-1.0.0.tgz
).The old regex
/^@|\/@/
matched such URLs, but the new one/(?:^|\/)(@[^\/?]+?)(?=%2f)/
doesn't. This means that authorization token is not sent with anytgz
requests.cc due to involvement in the original PR @lukeggchapman @BYK
The text was updated successfully, but these errors were encountered: