-
Notifications
You must be signed in to change notification settings - Fork 238
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
[RRFC] Only use registry provided URLs to fetch tarballs #472
Comments
Initial thoughts (we'll talk it through more in the meeting today, so any/all of this subject to change, of course). I'm definitely leaning in favor of this proposal.
If In environments where you're running |
Also, lockfiles are not required -- the repro does not use a lockfile, it simply breaks basic installs. |
In case you find it useful, we solved this problem in Yarn by specifying that "standard registry patterns" are of the form:
If the tarball in metadata matches this URL pattern, Yarn won't store the tarball path and will derive it automatically from whatever is the currently configured registry. If it doesn't, Yarn will store the full URL within the lockfile (which will break the "easy registry switch scenario"). We found this system of graceful degradation working fairly well for us. |
Notably, I believe that won't match any extant Artifactory registry. |
Indeed, but we didn't get requests to make it work nonetheless. Notably, a few issues have been raised by people using them, as evidenced by the logs they shared, but they never complained about it. There's also a decent case that as the registry maintainers, you probably have more pull to standardize this behavior if you so decided (ref https://github.com/npm/feedback/discussions/55). |
What are the next steps on this? Would love to help contribute in anyway I can. npm/cli#3533 is still an incredibly infuriating problem in npm. |
Motivation ("The Why")
npm 7 introduced a change where it computes tarball URLs from the registry name instead of using the URL provided by the registry. This causes third party registries that don't host their own tarballs to fail.
How
Current Behaviour
Tarball URLs are rewritten to one's that are not guaranteed to match the one's that are registry provided nor in the lockfile. This amounted to a substantial change to the npm protocol.
Desired Behaviour
This seems to have been implemented so that when you change your default registry, npm would download tarballs from the new registry regardless of the lockfile. This is clearly desirable behavior, but the assumptions about how third party registries store their tarballs are not always correct.
I would propose that:
A) The registry config in use when a lock-file is generated should be recorded to the lockfile.
B) When the currently configured registr(y|ies) changes (determined by comparing config to lockfile), npm will refresh tarball URLs by querying metadata from the new registry. This would allow for the new npm7 functionality without breaking third party registries that don't host their tarballs the same way that npmjs.org does.
Open Questions
References
The text was updated successfully, but these errors were encountered: