Skip to content

Commit

Permalink
chore(NODE-6635): pin NPM to 10 when Node version is 18
Browse files Browse the repository at this point in the history
  • Loading branch information
durran committed Jan 7, 2025
1 parent e903c40 commit 2a06f45
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .evergreen/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ buildvariants:
packager_distro: ubuntu2204
packager_arch: x86_64
NODE_LTS_VERSION: "18"
NPM_VERSION: "10"
tasks:
- run-tests-ubuntu
- run-tests-ubuntu-rtld
Expand Down Expand Up @@ -185,6 +186,7 @@ buildvariants:
packager_distro: ubuntu2204
packager_arch: arm64
NODE_LTS_VERSION: "18"
NPM_VERSION: "10"
tasks:
- run-tests-ubuntu
- run-tests-ubuntu-rtld
Expand Down
12 changes: 9 additions & 3 deletions .evergreen/install-dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,15 @@ set -o errexit # Exit the script with error if any of the commands fail
## 'latest'
## a full nodejs version, in the format v<major>.<minor>.patch
export NODE_LTS_VERSION=${NODE_LTS_VERSION:-14}
# npm version can be defined in the environment for cases where we need to install
# a version lower than latest to support EOL Node versions.
export NPM_VERSION=${NPM_VERSION:-latest}
# If NODE_LTS_VERSION is numeric and less than 18, default to 9, if less than 20, default to 10.
# Do not override if it is already set.
if [[ "$NODE_LTS_VERSION" =~ ^[0-9]+$ && "$NODE_LTS_VERSION" -lt 18 ]]; then
export NPM_VERSION=${NPM_VERSION:-9}
elif [[ "$NODE_LTS_VERSION" =~ ^[0-9]+$ && "$NODE_LTS_VERSION" -lt 20 ]]; then
export NPM_VERSION=${NPM_VERSION:-10}
else
export NPM_VERSION=${NPM_VERSION:-latest}
fi

echo "Installing Node.js $NODE_LTS_VERSION with npm@$NPM_VERSION"

Expand Down

0 comments on commit 2a06f45

Please sign in to comment.