Yarn hangs at [1/4] Resolving packages or fails silently if –verbose

yarn@1.12.1
npm@6.4.1
node@v10.12.0
Linux newbox 4.4.153

A mrc test case: fresh install of webpack alone (after purging all caches etc.)

%% rm -rf yarnfa
%% mkdir yarnfa && cd yarnfa
cp ~/tmp/package.json.yarnfa ./package.json
%% cat package.json
{
  "name": "yarnfa",
  "version": "0.1.0",
  "description": "yarn bug hang or silent",
  "main": "index.js",
  "repository": "",
  "author": "Ohir Ripe",
  "license": "none",
  "private": true,
  "devDependencies": {
    "webpack": "^4.23.0"
  }
}

cp ~/.yarnrc .
%% cat .yarnrc
cache-folder /tgg/cache
yarn-offline-mirror /tgg/offline
yarn-offline-mirror-pruning true

# check if env is clean. It is.
%% env | egrep -i 'nvm|npm|node'

yarn install

It is resolving some packages then it got stuck at number-is-nan@^1.0.0
Indicator spins but network download drops down to few hundred bps.
Without –verbose it then will hang (likely till lingering socket closes).
Repeated, it will hang on a few different packages from webpack deep deps.
Eg. ansi-regex, number-is-nan and a few others. None of them being huge.

If ran with --verbose yarn fails silently. Nothing is produced. The log last lines
are:

%% yarn install --verbose > faillog && tail -n7 faillog
 
verbose 33.809 Performing "GET" request to "https://registry.yarnpkg.com/ansi-regex".
verbose 33.866 Request "https://registry.yarnpkg.com/minizlib" finished with status code 200.
verbose 33.868 Request "https://registry.yarnpkg.com/code-point-at" finished with status code 200.
verbose 33.885 Request "https://registry.yarnpkg.com/is-fullwidth-code-point" finished with status code 200.
verbose 33.886 Performing "GET" request to "https://registry.yarnpkg.com/number-is-nan".
verbose 33.976 Request "https://registry.yarnpkg.com/ansi-regex" finished with status code 200.
verbose 34.001 Request "https://registry.yarnpkg.com/number-is-nan" finished with status code 200.

The beginning of the log got .yarnrc four times:

yarn install v1.12.1
verbose 0.32 Found configuration file "/tgg/yarnfa/.yarnrc".
verbose 0.321 Found configuration file "/home/user/.yarnrc".
verbose 0.321 Found configuration file "/tgg/yarnfa/.yarnrc".
verbose 0.321 Found configuration file "/home/user/.yarnrc".
[1/4] Resolving packages...

NOTE paths redacted. No .npmrc present.
Yarn found project .yarnrc twice! And then twice homedir’s one.
/tmp/yarnfa/.yarnrc is a copy of ~/.yarnrc
Current webpack version as of this filling is 4.23.1

NOTE possibly related to: #5055, #5491, #5512

Author: Fantashit

4 thoughts on “Yarn hangs at [1/4] Resolving packages or fails silently if –verbose

  1. I am also expiericing the mentioned behavoir.
    Setup: Node 10.14.1 | Yarn 1.12.3 | npm 6.4.1 | Windows 10 (1803)

    Using the following package.json

    {
      "name": "test-yarn-resolving-package",
      "version": "1.0.0",
      "description": "test-yarn-resolving-package",
      "main": "index.js",
      "author": "-",
      "license": "MIT",
      "private": true,
      "dependencies": {
        "react": "^16.6.1",
        "react-dom": "^16.6.1"
      },
      "devDependencies": {}
    }

    Steps to reproduce:
    Method one:

    • yarn add webpack --dev (creates a yarn.lock and succeeds)
    • yarn remove webpack
    • yarn add webpack --dev (stuck on resolving phase or silently quits with –verbose passed)

    Method two:

    • yarn install (creates a yarn.lock)
    • yarn add webpack --dev
  2. @JackTheRipper For the tooling it should not matter whether your network is fast or slow, whether it pass every packet or it drops 80%% of. This heisenbug is awfull especially for people with poor connectivity – as tool does not timeout you must either watch net speedometer or set an ancient alarm clock beside your box then tinker manually with node or module’s versions and you never know in what configurations yarn will progress. It gives that uneasy feeling that you can not trust in your basic tool.
    If it gives up, it should say why it did so.

Comments are closed.