Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to increase the timeout for `yarn install`

I'm currently using Yarn on a very unstable internet connection. Sometimes it takes hours until I can finally download all the packages.

I noticed Yarn retries the download when there is some kind of the internet connection:

[1/4] Resolving packages... 31-Dec-1969 21:00:00    [INFO] info There appears to be trouble with your  network connection. Retrying... 31-Dec-1969 21:00:00    [ERROR] error An unexpected error occurred:  "https://github.com/flot/flot: getaddrinfo EAI_AGAIN github.com:443". 

Is it possible to retry forever until it downloads or increase the timeout?

Something like {timeout: 9999999}

like image 915
Fabio K Avatar asked Dec 14 '17 11:12

Fabio K


People also ask

Where does Yarn look for Yarnrc?

Yarnrc files (named this way because they must be called . yarnrc. yml ) are the one place where you'll be able to configure Yarn's internal settings. While Yarn will automatically find them in the parent directories, they should usually be kept at the root of your project (often your repository).

What is Yarnrc?

yarnrc files allow you to configure additional Yarn features. The config command may also be used to set these options. Yarn will merge . yarnrc files up the file tree.

What is a network timeout?

Network timeout is an option that lets you decide how long you are willing to wait for an operation in a Workstation client before your request for that operation is canceled (timed out) on a network.

What is install state GZ?

. yarn/install-state. gz is an optimization file that you shouldn't ever have to commit. It simply stores the exact state of your project so that the next commands can boot without having to resolve your workspaces all over again.


2 Answers

Try using the network-timeout flag with a delay in milliseconds, like this:

yarn install --network-timeout 1000000000

like image 143
Crono Avatar answered Nov 09 '22 23:11

Crono


You can configure it with this:

yarn config set network-timeout 600000 -g 
like image 39
olawalejuwonm Avatar answered Nov 10 '22 01:11

olawalejuwonm