From d9efcf79427310af94338211d01b7d602f8741d9 Mon Sep 17 00:00:00 2001 From: Badri Date: Sat, 13 Aug 2022 11:18:25 +0530 Subject: [PATCH] Increase yarn network timeout to 10 minutes We often run into the error, `An unexpected error occurred: "https://registry.yarnpkg.com/date-fns/-/date-fns-2.29.1.tgz: ESOCKETTIMEDOUT".` This seems to be a common problem with the date-fns package, as well as other large packages installed with older versions of Yarn. See for example the following GitHub issues: https://github.com/date-fns/date-fns/issues/1004 https://github.com/yarnpkg/yarn/issues/8242 The problem seems to be related to slow hard-disk access on the client server/VPS - so it's actually the storage connection and not the Internet connection, that's timing out. A common workaround for this is to increase the network timeout for Yarn long enough for the build will complete, which is what we're doing in this case since it's likely to affect a lot of the slower setups (including, as it seems, the YunoHost CI!). For everyone else, the worst case is that they'll have to wait 10 minutes before they realise there's actually something wrong with the network. --- scripts/install | 2 ++ scripts/upgrade | 2 ++ 2 files changed, 4 insertions(+) diff --git a/scripts/install b/scripts/install index d3eebf2..c021ea3 100644 --- a/scripts/install +++ b/scripts/install @@ -133,6 +133,8 @@ ynh_script_progression --message="Building Ghost... (this will take some time an pushd "$final_path" ynh_use_nodejs + # Longer network timeouts for slow systems; see https://github.com/yarnpkg/yarn/issues/8242 + ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH yarn config set network-timeout 600000 ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH yarn add knex-migrator ember-cli --dev --ignore-workspace-root-check --non-interactive ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH yarn setup # catch-all command provided by Ghost that handles all the setup popd diff --git a/scripts/upgrade b/scripts/upgrade index d3ce02f..f47d571 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -176,6 +176,8 @@ then ynh_script_progression --message="Building Ghost... (this will take some time and resources!)" pushd "$final_path" + # Longer network timeouts for slow systems; see https://github.com/yarnpkg/yarn/issues/8242 + ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH yarn config set network-timeout 600000 ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH yarn install --non-interactive ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH yarn add knex-migrator ember-cli --dev --ignore-workspace-root-check --non-interactive ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH yarn setup