When I try to run my build job it fails on the windows build stage since the Node.js version on the runner is v12.10.0, when it should be v18.7.0.
Is it possible to set a specific Node.js version on the windows shared runner to fix this issue?
I have the following configuration in my .gitlab-ci.yml:
image: node:18.7.0
before_script:
- apt-get update -qq && apt-get install
- node -v
stages:
- build
.build:
stage: build
script:
- npm install --progress=false
- npm run build
build-linux:
extends: .build
tags:
- linux
artifacts:
name: "Linux build"
expire_in: 1 hour
paths:
- dist
build-windows:
extends: .build
tags:
- windows
artifacts:
name: "Windows build"
expire_in: 1 hour
paths:
- dist
Fixed the issue by creating .win-build
which contains choco upgrade nodejs -y
and then adding it to extends
in the build-windows
stage.
.win-build:
stage: build
script:
- choco upgrade nodejs -y
- npm install --progress=false
- npm run build
build-windows:
extends: .win-build
tags:
- windows
artifacts:
name: "Windows build"
expire_in: 1 hour
paths:
- dist