When attempting to install the dependencies for my project with Yarn via yarn install
, the process (and progress bar indicator) hangs when attempting to fetch packages. A timeout never occurs and the --verbose
option gives no useful clues regarding the cause of the problem.
CentOS 7
Yarn version: 0.27.5
This issue is caused by the combination of the older version of Git installed by Yum on CentOS (1.8.3.1-6 at the time of this writing) and Git's two-factor authentication mechanism.
Git's 2FA is the reason the hanging occurs in the first place, since one of the packages Yarn was attempting to fetch was a private repo via HTTPS (see here for details).
The version of the Git client in CentOS turned out to be the reason the hanging continued to occur and never timed / erred out. That is, the aforementioned version of Git on CentOS prevented Yarn from recognizing the authentication error and exiting accordingly.
The solution is to upgrade Git to a more recent version using a different repo:
sudo yum -y erase git
sudo rpm -U http://opensource.wandisco.com/centos/7/git/x86_64/wandisco-git-release-7-2.noarch.rpm
sudo yum -y install git
This will stop Yarn from continuing to hang, with an output similar to the following:
[1/4] Resolving packages...
[2/4] Fetching packages...
error Command failed.
Exit code: 128
Command: git
...
fatal: could not read Username for 'https://github.com': terminal prompts disabled
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With