Skip to content

Commit

Permalink
GitHubCI: improve nodejs update mechanism
Browse files Browse the repository at this point in the history
We found this easier method in StackOverflow [1].
The regression we were getting in the SanityCheck
job was:

```
+ npx commitlint --version
@commitlint/[email protected]
+ npx commitlint --from HEAD~1 --to HEAD --verbose
/__w/conventions/conventions/node_modules/typescript/lib/typescript.js:139
    for (let i = startIndex ?? 0; i < array.length; i++) {
                             ^

SyntaxError: Unexpected token '?'
    at wrapSafe (internal/modules/cjs/loader.js:915:16)
    at Module._compile (internal/modules/cjs/loader.js:963:27)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
    at Module.load (internal/modules/cjs/loader.js:863:32)
    at Function.Module._load (internal/modules/cjs/loader.js:708:14)
    at Module.require (internal/modules/cjs/loader.js:887:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at attemptRequireWithV8CompileCache (/__w/conventions/conventions/node_modules/ts-node/dist/util.js:104:16)
    at loadCompiler (/__w/conventions/conventions/node_modules/ts-node/dist/configuration.js:237:56)
    at resolveAndLoadCompiler (/__w/conventions/conventions/node_modules/ts-node/dist/configuration.js:226:16)
```

[1] https://stackoverflow.com/a/74217960/544947
  • Loading branch information
knocte committed Jun 2, 2023
1 parent 7b39d99 commit 908c11d
Showing 1 changed file with 19 additions and 5 deletions.
24 changes: 19 additions & 5 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,11 @@ jobs:
apt install --yes sudo
sudo apt install --yes --no-install-recommends git ca-certificates
sudo apt install --yes --no-install-recommends curl
# can't install ubuntu's default nodejs version because we would get this error:
sudo apt install --yes --no-install-recommends npm curl
# need to update nodejs because with ubuntu's default nodejs version we would get this error:
# error @jest/[email protected]: The engine "node" is incompatible with this module. Expected version "^14.15.0 || ^16.10.0 || >=18.0.0". Got "12.22.9"
curl --show-error --location https://deb.nodesource.com/setup_14.x | sudo --preserve-env bash -
sudo DEBIAN_FRONTEND=noninteractive apt install --yes --no-install-recommends nodejs
sudo npm install --global n
sudo n lts
- name: Print versions
run: |
git --version
Expand Down Expand Up @@ -115,7 +115,21 @@ jobs:
run: |
apt update && apt install --yes sudo
sudo apt install --yes --no-install-recommends git
sudo DEBIAN_FRONTEND=noninteractive apt install --yes --no-install-recommends npm
sudo apt install --yes --no-install-recommends npm curl
# need to update nodejs because with ubuntu's default nodejs version we would get this error:
# ```
# + npx commitlint --from HEAD~1 --to HEAD --verbose
# /__w/conventions/conventions/node_modules/typescript/lib/typescript.js:139
# for (let i = startIndex ?? 0; i < array.length; i++) {
# ^
#
# SyntaxError: Unexpected token '?'
# at wrapSafe (internal/modules/cjs/loader.js:915:16)
# ...
# ```
sudo npm install --global n
sudo n lts
- uses: actions/checkout@v2
with:
submodules: recursive
Expand Down

0 comments on commit 908c11d

Please sign in to comment.