From e2bf4cf9cb92c947847293bec3da7c07886c0aef Mon Sep 17 00:00:00 2001 From: Gerardo Date: Tue, 19 Mar 2024 12:05:46 +0100 Subject: [PATCH] Update Buildkite's install node dependencies command to set the maxsockets flag with a value that will change depending on the platform, for Mac jobs it'll use the default value from npm which is 15, for Linux it will use a value of 1 to prevent ECONNRESET errors --- .buildkite/commands/install-node-dependencies.sh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.buildkite/commands/install-node-dependencies.sh b/.buildkite/commands/install-node-dependencies.sh index 4f0d2ca954..7d6381f659 100755 --- a/.buildkite/commands/install-node-dependencies.sh +++ b/.buildkite/commands/install-node-dependencies.sh @@ -28,7 +28,18 @@ if [[ "${RESTORE_ONLY}" == 'true' ]]; then fi echo "--- :npm: Install Node dependencies" -npm ci --unsafe-perm --prefer-offline --no-audit --no-progress --maxsockets 1 "$@" + +MAX_SOCKETS=15 # Default value from npm + +# To avoid constant ECONNRESET errors a limit is set for Linux, +# as this is not happening with the Mac jobs. +# This issue is being tracked here: +# https://github.com/npm/cli/issues/4652 +if [ "$PLATFORM" = "Linux" ]; then + MAX_SOCKETS=1 +fi + +npm ci --unsafe-perm --prefer-offline --no-audit --no-progress --maxsockets "$MAX_SOCKETS" "$@" echo "--- :npm: Save cache if necessary" # Notice that we don't cache the local node_modules.