最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Why does `yarn install` hang when fetching packages on CentOS? - Stack Overflow

programmeradmin3浏览0评论

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

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

Share Improve this question asked Jul 9, 2017 at 20:30 user3006381user3006381 2,8853 gold badges25 silver badges33 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 5

This issue is caused by the bination 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./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.': terminal prompts disabled

My coworker and I had a similar issue and it was hanging because the vpn had disconnected. So double check your vpn is connected.

发布评论

评论列表(0)

  1. 暂无评论