berry icon indicating copy to clipboard operation
berry copied to clipboard

[Bug?]: Executing yarn dlx fails with Yarn 4.3.1 for mismatch hashes as Corepack tries to download Yarn 4.1.1 to execute yarn dlx

Open initshdb opened this issue 1 year ago • 0 comments

Describe the bug

I have Yarn latest (4.3.1) installed. Now when I try to use Yarn dlx command, Corepack tries to download Yarn 4.1.1, and then fails for mismatch hashes.

To reproduce

  • Install Yarn latest (4.3.1) globally
> corepack install -g yarn@latest

> yarn -v
4.3.1
  • Use yarn dlx. Here I am using yarn dlx to create a new Angular Project
> yarn dlx -p @angular/cli@16 ng new my-app --package-manager yarn --standalone false --style scss --routing

However this issue if for using yarn dlx globally in general outside a project. Even if I run yarn dlx -q envinfo --preset jest outside a project it results in the same issue.

  • Corepack tries to download Yarn 4.1.1, and then fails
! Corepack is about to download https://nexus-internal/repository/npm-public/@yarnpkg/cli-dist/-/cli-dist-4.1.1.tgz
? Do you want to continue? [Y/n] Y

Internal Error: Mismatch hashes. Expected 00f08619463229f8ba40c4ee90e8c2e4ced1f11c3115c26f3b98432e, got
 c457ddb8425f8e55f5f4d5edaa9cd1c247904518fd7b14fd317b7f2a
    at installVersion (C:\Users\initsh\Project\installation\node\node-v18.20.2-win-
x64\node_modules\corepack\dist\lib\corepack.cjs:23161:11)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Engine.ensurePackageManager (C:\Users\initsh\Project\installation\node\node-v18.20.2-win-
x64\node_modules\corepack\dist\lib\corepack.cjs:23588:32)
    at async Engine.executePackageManagerRequest (C:\Users\initsh\Project\installation\node\node-v18.20.2-win-
x64\node_modules\corepack\dist\lib\corepack.cjs:23693:25)
    at async BinaryCommand.validateAndExecute (C:\Users\initsh\Project\installation\node\node-v18.20.2-win-
x64\node_modules\corepack\dist\lib\corepack.cjs:21164:22)
    at async _Cli.run (C:\Users\initsh\Project\installation\node\node-v18.20.2-win-
x64\node_modules\corepack\dist\lib\corepack.cjs:22139:18)
    at async Object.runMain (C:\Users\initsh\Project\installation\node\node-v18.20.2-win-
x64\node_modules\corepack\dist\lib\corepack.cjs:24391:12)

Environment

System:
  OS: Windows 10 10.0.19045
  CPU: (8) x64 Intel(R) Core(TM) i5-10310U CPU @ 1.70GHz
Binaries:
  Node: 18.20.2 - ~\AppData\Local\Temp\xfs-9f313e52\node.CMD
  Yarn: 4.3.1 - ~\AppData\Local\Temp\xfs-9f313e52\yarn.CMD
  npm: 10.5.0 - ~\Project\installation\node\node-v18.20.2-win-x64\npm.CMD

Additional context

Work around is to remove Yarn 4.3.1 and install 4.1.1 instead.

initshdb avatar Jul 31 '24 04:07 initshdb