Skip to content

Commit 908c11d

Browse files
committed
GitHubCI: improve nodejs update mechanism
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
1 parent 7b39d99 commit 908c11d

File tree

1 file changed

+19
-5
lines changed

1 file changed

+19
-5
lines changed

.github/workflows/CI.yml

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,11 @@ jobs:
7474
apt install --yes sudo
7575
sudo apt install --yes --no-install-recommends git ca-certificates
7676
77-
sudo apt install --yes --no-install-recommends curl
78-
# can't install ubuntu's default nodejs version because we would get this error:
77+
sudo apt install --yes --no-install-recommends npm curl
78+
# need to update nodejs because with ubuntu's default nodejs version we would get this error:
7979
# 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"
80-
curl --show-error --location https://deb.nodesource.com/setup_14.x | sudo --preserve-env bash -
81-
sudo DEBIAN_FRONTEND=noninteractive apt install --yes --no-install-recommends nodejs
80+
sudo npm install --global n
81+
sudo n lts
8282
- name: Print versions
8383
run: |
8484
git --version
@@ -115,7 +115,21 @@ jobs:
115115
run: |
116116
apt update && apt install --yes sudo
117117
sudo apt install --yes --no-install-recommends git
118-
sudo DEBIAN_FRONTEND=noninteractive apt install --yes --no-install-recommends npm
118+
119+
sudo apt install --yes --no-install-recommends npm curl
120+
# need to update nodejs because with ubuntu's default nodejs version we would get this error:
121+
# ```
122+
# + npx commitlint --from HEAD~1 --to HEAD --verbose
123+
# /__w/conventions/conventions/node_modules/typescript/lib/typescript.js:139
124+
# for (let i = startIndex ?? 0; i < array.length; i++) {
125+
# ^
126+
#
127+
# SyntaxError: Unexpected token '?'
128+
# at wrapSafe (internal/modules/cjs/loader.js:915:16)
129+
# ...
130+
# ```
131+
sudo npm install --global n
132+
sudo n lts
119133
- uses: actions/checkout@v2
120134
with:
121135
submodules: recursive

0 commit comments

Comments
 (0)