Skip to content

Commit e7225e1

Browse files
committed
chore(NODE-6634): pin NPM to 10 when Node version is 18
1 parent 1fed073 commit e7225e1

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

.evergreen/install-dependencies.sh

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,15 @@ set -o errexit # Exit the script with error if any of the commands fail
66
## 'latest'
77
## a full nodejs version, in the format v<major>.<minor>.patch
88
export NODE_LTS_VERSION=${NODE_LTS_VERSION:-16}
9-
# npm version can be defined in the environment for cases where we need to install
10-
# a version lower than latest to support EOL Node versions.
11-
export NPM_VERSION=${NPM_VERSION:-latest}
9+
# If NODE_LTS_VERSION is numeric and less than 18, default to 9, if less than 20, default to 10.
10+
# Do not override if it is already set.
11+
if [[ "$NODE_LTS_VERSION" =~ ^[0-9]+$ && "$NODE_LTS_VERSION" -lt 18 ]]; then
12+
export NPM_VERSION=${NPM_VERSION:-9}
13+
elif [[ "$NODE_LTS_VERSION" =~ ^[0-9]+$ && "$NODE_LTS_VERSION" -lt 20 ]]; then
14+
export NPM_VERSION=${NPM_VERSION:-10}
15+
else
16+
export NPM_VERSION=${NPM_VERSION:-latest}
17+
fi
1218

1319
source $DRIVERS_TOOLS/.evergreen/install-node.sh
1420

0 commit comments

Comments
 (0)