berry: [Bug]: yarn install hangs at Resolution Step

Self-service

  • I’d be willing to implement a fix

Describe the bug

When running yarn install or just yarn, the installer seems to hang at one package during the Resolution Step, seemingly using 0 resources overall. This happens on version 3.2.0, when using both public and private sources (all of them are public, only one is private), hanging always on a public package, not always the same though, but it seems to cycle through them. Making the system wait before installation seems to get it farther in, but it fixees nothing. The packages install fine using npm.

To reproduce

Remove the lockfile and run yarn with a lockfile that contains 1987 packages, one of them from a private repo requiring SSH authentication.

Environment

System: 
OS: Linux 5.16 Parrot OS 5.0 (Electro Ara) 5.0 (Electro Ara) 
CPU: (4) x64 Intel(R) Celeron(R) N4120 CPU @ 1.10GHz 
Binaries: 
Node: 16.14.2 - /tmp/xfs-16d9b8e0/node 
Yarn: 3.2.0 - /tmp/xfs-16d9b8e0/yarn npm: 8.6.0 - ~/.nvm/versions/node/v16.14.2/bin/npm

Additional context

No response

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 1
  • Comments: 17 (2 by maintainers)

Most upvoted comments

after install yarn you need yarn set version 1.22.1 is stable and it will solve your problem. (yarn version > 3 bug)

package.json yarn.zip Copying these two files into a new folder and running yarn upgrade-interactive in it, and selecting the first package to upgrade does it for me. Some other combinations of packages to upgrade have the same effect. Yarn 4.0.1 via corepack, node 20.9.0

I have this issue too, can take over 4 minutes

➤ YN0000: · Yarn 4.0.1
➤ YN0000: ┌ Resolution step
➤ YN0085: │ .....
➤ YN0000: └ Completed in 4m 60s
➤ YN0000: ┌ Post-resolution validation
➤ YN0060: │ ....
➤ YN0002: │ ....
➤ YN0086: │ Some peer dependencies are incorrectly met; run yarn explain peer-requirements <hash> for details, where <hash> is the six-letter p-prefixed code.
➤ YN0000: └ Completed
➤ YN0000: ┌ Fetch step
➤ YN0013: │ 2 packages were added to the project, and 2 were removed (- 146.86 KiB).
➤ YN0000: └ Completed in 3s 102ms
➤ YN0000: ┌ Link step
➤ YN0008: │ .... must be rebuilt because its dependency tree changed
➤ YN0000: └ Completed in 0s 971ms
➤ YN0000: · Done with warnings in 5m 4s
  System:
    OS: Linux 6.5 Ubuntu 23.10 23.10 (Mantic Minotaur)
    CPU: (20) x64 13th Gen Intel(R) Core(TM) i9-13900H
  Binaries:
    Node: 18.18.2 - /tmp/xfs-d86194ec/node
    Yarn: 4.0.1 - /tmp/xfs-d86194ec/yarn
    npm: 9.8.1 - ~/.nvm/versions/node/v18.18.2/bin/npm
    pnpm: 8.9.2 - ~/.nvm/versions/node/v18.18.2/bin/pnpm
    bun: 1.0.7 - ~/.bun/bin/bun

I am encountering the same issue with latest yarn and it reported “Completed in 2m 25s” but you do not really get any feedback that is doing anything. I was not able to spot a CPU spike either. I do suspect that it might be caused by some networking throttling on the server side (npm.org) but I have no proof as no logging happens. If one or two requirest need to timeout (likely 30s default) it might explain why it get “stuck”.

I’m seeing similar behavior while invoking yarn install inside a container. It doesn’t happen on my Linux or Mac OS host systems.

Specifically, I see yarn hanging after the end of the resolution step.

➤ YN0000: ┌ Resolution step
[various peer dependency warnings]
➤ YN0000: │ Some peer dependencies are incorrectly met; run yarn explain peer-requirements <hash> for details, where <hash> is the six-letter p-prefixed code
➤ YN0000: └ Completed in 0s 566ms

I have isolated the issue; it is an endless-loop bug in diff@4.0.1 which is used by yarn@3.2.0. The bug also manifests in the latest version of diff@5.0.0 so it looks like Yarn is depending on a fundamentally buggy tool.

I’ll file a new yarn issue to recommend that Yarn use some sort of timeout, or otherwise guard against runaway diff, or give us a way to opt out of diffing.

Looks like this is a manifestation of Node bug https://github.com/nodejs/node/issues/46060

This is still an issue with yarn 4.0.1 … even with nothing fancy configured:

cacheFolder: ./.yarn/cache

compressionLevel: mixed

defaultSemverRangePrefix: ""

enableGlobalCache: false

logFilters:
  - code: YN0013
    level: discard

nodeLinker: node-modules

yarnPath: .yarn/releases/yarn-4.0.1.cjs

What I do is run yarn upgrade-interactive, select a few dependencies, confirm and get stuck at:

➤ YN0000: · Yarn 4.0.1
➤ YN0000: ┌ Resolution step

At this point it can’t even be killed by ctrl+c or ctrl+d and I have to sigkill that. This is on node node v20.4.0