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

Yarn hangs at [1/4] Resolving packages or fails silently if --verbose #6610

Closed
ohir opened this issue Oct 31, 2018 · 17 comments
Closed

Yarn hangs at [1/4] Resolving packages or fails silently if --verbose #6610

ohir opened this issue Oct 31, 2018 · 17 comments
Assignees
Labels
fixed-in-modern This issue has been fixed / implemented in Yarn 2+. triaged

Comments

@ohir
Copy link

ohir commented Oct 31, 2018

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

@ghost ghost assigned arcanis Oct 31, 2018
@ghost ghost added the triaged label Oct 31, 2018
@ddpardo
Copy link

ddpardo commented Dec 1, 2018

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

@konpikwastaken
Copy link

+1

@ghost
Copy link

ghost commented Jan 16, 2019

Hi, I am facing the same issue with yarn@1.13.0. It happens to me when using a private registry. The step 1 (resolving packages) works well but yarn exits with no logs when it starts fetching.

Regarding my network, I am using a whitelisting for fetching from my private registry.

@arcanis : any clues about what could be happening?

@gcaaa31928
Copy link

+1

@ghost
Copy link

ghost commented Jan 17, 2019

Good news - in our case it seems to be more related to our network than anything else :D Sorry !

@ohir
Copy link
Author

ohir commented Jan 18, 2019

@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.

@ghost
Copy link

ghost commented Jan 21, 2019

@ohir , I agree with you that the tool has to tell you what's up. But in our case, it's due to some weird settings in our proxy which creates a timeout while trying to retrieve the tarballs.

And that's why yarn dies silently I guess

@konpikwastaken
Copy link

Just some info in case anyone is looking into this - No proxy (http/https) here and network connection is stable but yarn fails with network connectivity issues. Downgrading to 1.9.4 seems more stable (and exits with the proper non-zero code) all subsequent versions bail with status code zero (which is a lie) and everything fails. Private registry.

@krzysztofgawrys
Copy link

launching with --network-concurrency 1 helps, yet whole "speed advantage" is out the window

@nathanosdev
Copy link

@profrook's solution worked for me, although it took ages!

@devmattrick
Copy link

I'm having the same issues as well, but also specifically on number-is-nan@^1.0.0, interestingly. Is there something about that specific package that's causing the issue?

@jousepo
Copy link

jousepo commented Mar 8, 2019

Same here with 1.13.0 / 1.14.0rc in Fedora 28 with a specific package with #develop.
In other computer with Ubuntu it works ok without problems....

EDIT: After a few retries it works but waiting a lot of time to resolve the dependency

@iranmarcius
Copy link

iranmarcius commented Aug 16, 2019

I'm having the same problem trying to use my private registry. The package is being transfered from it but it stuck at 'Resolving packages...'

My private registry is an apache http server with no authentication. the packages are in tgz format wich coontains package.json and the source files.

Yarn 1.17.3

@Jeff-Tian
Copy link

Jeff-Tian commented Oct 26, 2020

I met the same hang issues on [1/4] Resolving packages ...
It is super slow, that takes hours to complete.

By yarn --verbose that turns out the private registry connection is super slow.

Fixed by changing the .npmrc to public registry for those many public packages, and use slow registry only for scoped packages:

@company: registry = https://company-slow-registry.com
registry = https://registry.npmjs.org/

@merceyz
Copy link
Member

merceyz commented Jan 2, 2021

Closing as fixed in v2 where the timeout logic is less susceptible to this sort of issue

https://yarnpkg.com/getting-started/migration

@merceyz merceyz closed this as completed Jan 2, 2021
@merceyz merceyz added the fixed-in-modern This issue has been fixed / implemented in Yarn 2+. label Jan 2, 2021
@ivorhoulker
Copy link

Apologies for resurrecting this, but I found this while experiencing exactly the same behaviour in yarn v2. My yarn install always hangs retrieving one specific large package (mediasoup). Yarn version is 2.4.0, and I've tried setting:

httpTimeout: 1000000000
httpRetry: 10

In yarnrc.yml but I'm still getting the same whenever I try to install, so install will not complete. The only clue I'm able to get that something is wrong is if I check .yarn/cache and that package is missing, and that my progress bar never quite gets to the end. Yarn 2 also doesn't seem to offer a verbose way of dealing with this, as inline builds obviously doesn't help with network errors/download stage. Installing on a GCP vps if that makes any difference.

Thanks for any help you can give me.

@merceyz
Copy link
Member

merceyz commented Jan 28, 2021

Open a issue in the v2 repo if you feel like this is a bug, I would assume it's network issues though which we can't do anything about.


In yarnrc.yml but I'm still

Do you mean .yarnrc.yml?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fixed-in-modern This issue has been fixed / implemented in Yarn 2+. triaged
Projects
None yet
Development

No branches or pull requests