Skip to content

Commit

Permalink
fix: test error on Node.js v18 and npm v11 (#37)
Browse files Browse the repository at this point in the history
npm v11 has dropped the support for Node.js v18:
https://github.com/npm/cli/releases/tag/v11.0.0

So this change installs npm v10 instead on Nodde.js v18.

```sh-session
$ npm v [email protected] engines
{ node: '^20.17.0 || >=22.9.0' }

$ npm v [email protected] engines
{ node: '^18.17.0 || >=20.5.0' }
```
  • Loading branch information
ybiquitous authored Dec 23, 2024
1 parent 9b110db commit 8fd670c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/nodejs-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
strategy:
fail-fast: false
matrix:
node-version: ["lts/*", "20", "16"]
node-version: ["lts/*", "20", "18", "16"]
os: ["ubuntu-latest"]
uses: ./.github/workflows/nodejs-test-reusable.yml
with:
Expand Down
17 changes: 11 additions & 6 deletions .github/workflows/nodejs-test-reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,18 @@ jobs:

- name: Update npm to latest
shell: bash
# NOTE: npm v10 has dropped support for Node.js v16.
run: |
if [[ $(node -v) =~ ^v(16|14|12|10)\. ]]; then
npm install --global npm@9
else
npm install --global npm@latest
fi
case $(node -v) in
v16.*|v14.*|v12.*|v10.*)
npm install --global npm@9
;;
v18.*)
npm install --global npm@10
;;
*)
npm install --global npm@latest
;;
esac
echo "Successfully updated npm to $(npm -v)"
- name: Install dependencies
Expand Down

0 comments on commit 8fd670c

Please sign in to comment.