Cloudflare pages 사용시 Node.js 버전 설정

이원창·2022년 5월 30일
0

배경

현재 프론트엔드 배포자동화 툴을 github actions + aws ecs 에서
cloudflare pages로 변경하고자합니다.

문제

그러나 cloudflare의 기본 node.js 버전이 12.18.0 인 관계로 배포과정에 문제가 발생하였습니다.

error jest-watch-typeahead@1.1.0: The engine "node" is incompatible with this module. Expected version "^12.22.0 || ^14.17.0 || >=16.0.0". Got "12.18.0"
error Found incompatible module.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
Error during Yarn install
Failed: build command exited with code: 1
Failed: an internal error occurred

참고:
https://developers.cloudflare.com/pages/platform/build-configuration/

해결

원하는 노드버전을 .nvmrc 파일 또는 .node-version 파일로 작성한다

# 현재 사용 중인 노드 버전을 .nvmrc 파일로 작성
node -v > .nvmrc
profile
잊지 않기 위해 기록합니다

0개의 댓글