Skip to content

Commit

Permalink
fix(ci): use npm@9.x
Browse files Browse the repository at this point in the history
Previously, our CI on Node.js 20 was failing silently (e.g.
the bug fixed by #1591
did make mocha exit with a non-zero exit code, but not our CI).

This is being caused by an incompatibility between npm@8.x and
Node.js 20 (which could reasonably be argued to be a Node.js bug,
the same one that the PR mentioned above accounts for). Upgrading
to npm@9.x should fix this because it includes a fix in npm
as well (npm/cli#6399).
  • Loading branch information
addaleax committed Aug 17, 2023
1 parent 6659748 commit 4e89881
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions .evergreen/install-node.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export BASEDIR="$PWD/.evergreen"
if [ "$OS" == "Windows_NT" ]; then
powershell "$(cygpath -w "$BASEDIR")"/InstallNode.ps1
. "$BASEDIR/setup-env.sh"
mkdir -p "$BASEDIR/npm-8" && (cd "$BASEDIR/npm-8" && echo '{}' > package.json && npm i npm@8.x)
mkdir -p "$BASEDIR/npm-8" && (cd "$BASEDIR/npm-8" && echo '{}' > package.json && npm i npm@9.x)

curl -sSfLO https://raw.githubusercontent.com/mongodb-js/compass/42e6142ae08be6fec944b80ff6289e6bcd11badf/.evergreen/node-gyp-bug-workaround.sh && bash node-gyp-bug-workaround.sh
else
Expand Down Expand Up @@ -58,7 +58,7 @@ else
npm cache clear --force || true # Try to work around `Cannot read property 'pickAlgorithm' of null` errors in CI
# Started observing CI failures on RHEL 7.2 (s390x) for installing npm, all
# related to network issues hence adding a retry with backoff here.
bash "$BASEDIR/retry-with-backoff.sh" npm i -g npm@8.x
bash "$BASEDIR/retry-with-backoff.sh" npm i -g npm@9.x
fi

. "$BASEDIR/setup-env.sh"
4 changes: 2 additions & 2 deletions scripts/docker/rocky8-package.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ RUN dnf -y install epel-release
RUN dnf -y install python3 rpm-build dpkg-devel dpkg-dev git

# Add Node.js
RUN curl -sL https://rpm.nodesource.com/setup_16.x | bash -
RUN curl -sL https://rpm.nodesource.com/setup_20.x | bash -
RUN dnf install -y nodejs
RUN npm i -g npm@8.x
RUN npm i -g npm@9.x
# For some reason npm@8 failed silently (!) when $HOME was
# set to /root and consequently $HOME/.npm was not writable
RUN mkdir -p /tmp/home
Expand Down

0 comments on commit 4e89881

Please sign in to comment.