Open mcenkar opened 1 year ago
This looks great thanks for debugging! I'm sure the Yarn team would appreciate a PR. I think it's OK to drop the __archiveUrl
as you have done in your test files.
i got the same issue, is there any solution to fix it ?
i got the same issue, is there any solution to fix it ?
You can try my patched version from https://github.com/yarnpkg/berry/issues/5085#issuecomment-1365827021
Please report if it worked for you 🙏🏻
We've worked around it at Convoy by running the following find/replace on the v1 lockfile right before migrating it to Berry:
sed -i 's|/-/@company/|/-/|' yarn.lock
Of course, replace @company
with your organization's internal package scope.
I had attempted to resolve it here but I guess my fix didn't work as expected.
Looks like I have the same error, but with public packages while using JFrog as proxy
I'm currently looking at using Yarn 4 in one of our projects. We have a private artifactory using JFrog that hosts our internal packages. I have to use it to as a proxy for public packages, as historically not all of our internal packages were scoped, so I can't configure npmScopes to resolve public packages using Yarn registry.
During first yarn install I get the following error:
➤ YN0000: · Yarn 4.4.0
➤ YN0000: ┌ Resolution step
➤ YN0001: │ Error: google-protobuf@~3.21.2, <4 isn't supported by any available resolver
at yg.getResolverByDescriptor (/Users/username/.cache/node/corepack/yarn/4.4.0/yarn.js:141:1698)
at yg.bindDescriptor (/Users/username/.cache/node/corepack/yarn/4.4.0/yarn.js:141:1083)
at t.preparePackage (/Users/username/.cache/node/corepack/yarn/4.4.0/yarn.js:210:6173)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Z (/Users/username/.cache/node/corepack/yarn/4.4.0/yarn.js:210:7587)
at async Promise.allSettled (index 20)
at async _c (/Users/username/.cache/node/corepack/yarn/4.4.0/yarn.js:140:53121)
➤ YN0000: └ Completed in 2s 535ms
➤ YN0000: · Failed with errors in 2s 545ms
.yarnrc.yml:
npmAlwaysAuth: true
npmAuthIdent: "my-npm-credentials"
npmRegistryServer: "https://artifactory.companyname.com/.."
I've checked our artifactory for this package, and it obviously exists, and the version range above should resolve correctly, as we didn't have any such issues with npm and pnpm.
@xalechez Looks like you have a dependency specified as "google-protobuf": "~3.21.2, <4"
somewhere? That's not a valid semver range.
Thanks @clemyan, haven't noticed that. After overriding this dependency everything works
I'm seeing @types/node@^16.11.7 isn't supported by any available resolver
after upgrading from Yarn 3 to Yarn 4.
Similar to @xalechez we're using Artifactory as a proxy for public packages.
➤ YN0001: │ Error: @types/node@^16.11.7 isn't supported by any available resolver
at MultiResolver.getResolverByDescriptor (/path/to/.yarn/releases/yarn-4.4.0-git.20240811.hash-7fab4f1.cjs:32523:19)
at MultiResolver.bindDescriptor (/path/to/.yarn/releases/yarn-4.4.0-git.20240811.hash-7fab4f1.cjs:32492:33)
at _Project.preparePackage (/path/to/.yarn/releases/yarn-4.4.0-git.20240811.hash-7fab4f1.cjs:55671:36)
at async startPackageResolution (/path/to/.yarn/releases/yarn-4.4.0-git.20240811.hash-7fab4f1.cjs:55728:27)
at async Promise.allSettled (index 10)
at async allSettledSafe (/path/to/.yarn/releases/yarn-4.4.0-git.20240811.hash-7fab4f1.cjs:26925:21)
at async /path/to/.yarn/releases/yarn-4.4.0-git.20240811.hash-7fab4f1.cjs:55802:15
at async StreamReport.startProgressPromise (/path/to/.yarn/releases/yarn-4.4.0-git.20240811.hash-7fab4f1.cjs:32348:20)
at async _Project.resolveEverything (/path/to/.yarn/releases/yarn-4.4.0-git.20240811.hash-7fab4f1.cjs:55715:11)
at async /path/to/.yarn/releases/yarn-4.4.0-git.20240811.hash-7fab4f1.cjs:56407:13
My lockfile has this preexisting resolved entry from Yarn 3:
__metadata:
version: 6
cacheKey: 8
"@types/node@npm:^16.11.7, @types/node@npm:^16.18.39":
version: 16.18.96
resolution: "@types/node@npm:16.18.96"
checksum: c5b4c20868e1ecb2e3b975b37aeeb5790b3a4f1472b496fae779ac4f14ba4fb4c0e9ed8e9b6eb389e5a074371056130c9d6506705b144b4f6985ffa844556242
languageName: node
linkType: hard
Tracing out the resolving i can see two instances: @types/node@^16.11.7
and @types/node@npm:^16.11.7
(the latter doesn't exist in any package.json
files), where the former has a resolved ident hash and the latter doesn't, yet its the former which is failing to resolve.
I'm getting similar issues in a few different repositories after attempting upgrading from Yarn 3 to 4, where it's a random open source package each time, and removing the problematic dep results in a different one claiming it fails to resolve.
Self-service
Describe the bug
Hi,
we have internal artifactory, which mirrors external + publishes some
@scoped
packages. When following migration steps from https://yarnpkg.com/getting-started/migration I'm getting following error:I have more or less managed to trace down issue to this line: https://github.com/yarnpkg/berry/blob/%40yarnpkg/core/3.3.1/packages/yarnpkg-core/sources/LegacyMigrationResolver.ts#L20-L22
After applying following patch, building locally and replacing yarn.js I don't get this error anymore and everything works:
But as you see I had to change some existing assertions. (I can explain changes in regex, basically it's capturing
@scope
, and adding support if it's repeated in package name after/-/
) Unfortunately I'm not familiar with codebase and cannot say if removing__archiveUrl
is a good idea. Alternatively when debugging I spotted that https://github.com/yarnpkg/berry/blob/%40yarnpkg/cli/3.3.1/packages/plugin-npm/sources/NpmSemverResolver.ts#L19 this resolver returnsfalse
when passedrange
with__archiveUrl
, which probably shouldn't happen reading https://github.com/yarnpkg/berry/blob/%40yarnpkg/cli/3.3.1/packages/plugin-npm/tests/NpmSemverResolver.test.ts#L7. However support there is only ingetSatisfying
, not insupportsDescriptor
.To reproduce
You need project with yarn@1, and dependency of following structure: https://github.com/yarnpkg/berry/blob/%40yarnpkg/core/3.3.1/packages/yarnpkg-core/tests/LegacyMigrationResolver.test.ts#L20
Environment