Skip to content
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

[Bug] LegacyMigrationResolver fails to handle aliases #2012

Closed
1 task
merceyz opened this issue Oct 20, 2020 · 3 comments · Fixed by #2570
Closed
1 task

[Bug] LegacyMigrationResolver fails to handle aliases #2012

merceyz opened this issue Oct 20, 2020 · 3 comments · Fixed by #2570
Labels
bug Something isn't working reproducible This issue can be successfully reproduced

Comments

@merceyz
Copy link
Member

merceyz commented Oct 20, 2020

  • I'd be willing to implement a fix

Describe the bug

The LegacyMigrationResolver fails to convert aliases from Yarn V1.
This part of the lockfile is parsed to [email protected] instead of [email protected]

"vue-loader-v16@npm:vue-loader@^16.0.0-beta.7":
  version "16.0.0-beta.8"

To Reproduce

Reproduction

Playground

await packageJson({
 dependencies: {
 	'vue-loader-v16': 'npm:vue-loader@^16.0.0-beta.7',
 },
});

require('fs').writeFileSync(
 `yarn.lock`,
 `# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1

"vue-loader-v16@npm:vue-loader@^16.0.0-beta.7":
version "16.0.0-beta.8"
resolved "https://registry.yarnpkg.com/vue-loader/-/vue-loader-16.0.0-beta.8.tgz#1f523d9fea8e8c6e4f5bb99fd768165af5845879"
integrity sha512-oouKUQWWHbSihqSD7mhymGPX1OQ4hedzAHyvm8RdyHh6m3oIvoRF+NM45i/bhNOlo8jCnuJhaSUf/6oDjv978g==
`
);

await expect(yarn(`install`)).resolves.toBeTruthy();

Output:

Error: �[2mexpect(�[22m�[31mreceived�[39m�[2m).�[22mresolves�[2m.�[22mtoBeTruthy�[2m()�[22m

Received promise rejected instead of resolved
Rejected to value: �[31m[Error: Command failed: /usr/local/bin/node /sandbox/berry/scripts/actions/../run-yarn.js install·�[39m
�[31m➤ YN0000: ┌ Resolution step�[39m
�[31m➤ YN0016: │ vue-loader-v16@npm:16.0.0-beta.8: Registry failed to return reference "16.0.0-beta.8"�[39m
�[31m➤ YN0000: └ Completed�[39m
�[31m➤ YN0000: Failed with errors in 0s 159ms�[39m
�[31m]�[39m
 at expect (/sandbox/node_modules/expect/build/index.js:138:15)
 at module.exports (evalmachine.<anonymous>:20:7)

Environment if relevant (please complete the following information):

  • OS: Windows 7
  • Node version: v12.19.0
  • Yarn version: 2.3.3.dev
@merceyz merceyz added the bug Something isn't working label Oct 20, 2020
@yarnbot
Copy link
Collaborator

yarnbot commented Oct 20, 2020

We couldn't reproduce your issue (all the assertions passed on master).

@yarnbot yarnbot added the unreproducible This issue cannot be reproduced on master label Oct 20, 2020
@merceyz merceyz added reproducible This issue can be successfully reproduced and removed unreproducible This issue cannot be reproduced on master labels Oct 21, 2020
@Knagis
Copy link

Knagis commented Jan 6, 2021

I can confirm that this issue is reproducible. In my case "mock-socket-6": "npm:[email protected]", was installed with yarn v1 but the yarn.lock triggered error when running first install on yarn 2.4.0

@Petercopter
Copy link

Petercopter commented Feb 22, 2021

Confirmed here as well. Attempting to migrate from Yarn 1 to Berry. Running yarn install while following the migration guide.

Relevant Yarn 1 yarn.lock lines:

"@vue/cli-service@^4.0.0":
  version "4.5.11"
  resolved "https://registry.yarnpkg.com/@vue/cli-service/-/cli-service-4.5.11.tgz#b157e2eee2351889cbbd4ccb4a4a9d8575409175"
  integrity sha512-FXeJh2o6B8q/njv2Ebhe9EsLXt9sPMXGDY5zVvcV5jgj9wkoej9yLfnmwWCau5kegNClP6bcM+BEHuMYxJ+ubQ==
  dependencies:
    ...
  optionalDependencies:
    vue-loader-v16 "npm:vue-loader@^16.1.0"
$ yarn install
> YN0000:  Resolution step
i [Error]: vue-loader-v16@npm:16.1.2: Registry failed to return reference "16.1.2"
    at Object.resolve (/Users/peter/work/performance-frontend/.yarn/releases/yarn-berry.cjs:2:231391)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:94:5)
    at async n.resolve (/Users/peter/work/performance-frontend/.yarn/releases/yarn-berry.cjs:2:336461)
    at async n.resolve (/Users/peter/work/performance-frontend/.yarn/releases/yarn-berry.cjs:2:336461)
    at async /Users/peter/work/performance-frontend/.yarn/releases/yarn-berry.cjs:2:356788
    at async Module.w (/Users/peter/work/performance-frontend/.yarn/releases/yarn-berry.cjs:2:417407)
    at async d (/Users/peter/work/performance-frontend/.yarn/releases/yarn-berry.cjs:2:356751)
    at async Promise.all (index 48) {
  reportExtra: undefined,
  reportCode: 16
}

Now what I found interesting was that there IS a vue-loader-v16 package in the npm registry:
https://www.npmjs.com/package/vue-loader-v16

The user was nice enough to be sure and mark it as a learning package. But notice how Berry was trying to install vue-loader-v16@npm:16.1.2. The only reason it failed is because that forked package doesn't have that version number.

So something with aliases does appear to be going very sideways.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working reproducible This issue can be successfully reproduced
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants