Skip to content

Commit

Permalink
Update Buildkite's install node dependencies command to set the maxso…
Browse files Browse the repository at this point in the history
…ckets 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
  • Loading branch information
Gerardo committed Mar 19, 2024
1 parent 8926934 commit e2bf4cf
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion .buildkite/commands/install-node-dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit e2bf4cf

Please sign in to comment.