Jenkins CI 서버에서 yarn install --frozen-lockfile 실행 시 Node.js 엔진 호환성 에러 발생.
error @vitejs/[email protected]: The engine "node" is incompatible with this module.
Expected version "^20.19.0 || >=22.12.0". Got "20.10.0"
error [email protected]: The engine "node" is incompatible with this module.
Expected version "^20.19.0 || ^22.12.0 || >=24.0.0". Got "20.10.0"
| 환경 | Node.js 버전 | 비고 |
|---|---|---|
| Jenkins CI | 20.10.0 | lint/typecheck 실행 |
| Docker (Dev/QA/Stg/Prod) | 22 | 빌드 및 런타임 |
모든 Jenkinsfile에 --ignore-engines 옵션 추가.
# 변경 전
sh "yarn install --frozen-lockfile"
# 변경 후
sh "yarn install --frozen-lockfile --ignore-engines"
Jenkins의 yarn install은 lint/typecheck 실행을 위한 것으로, 실제 빌드는 Docker 내부에서 수행됨.
Jenkins (Node 20.10.0)
├── yarn install --ignore-engines <- 엔진 체크만 무시
├── yarn lint <- ESLint 실행
├── yarn tsc --noEmit <- 타입 체크
│
└── docker build
│
└── Docker 내부 (Node 22)
├── yarn install <- 여기서 다시 설치 (문제없음)
└── yarn build <- 여기서 실제 빌드