[ElasticBeanstalk] Next.js 배포 시 에러 발생: [Error: ENOENT: no such file or directory, open ‘/var/app/current/.next/BUILD_ID’]

sig03
Jan 24, 2024

--

  1. 문제
  • Elastic Beanstalk에 Next.js를 배포하려 함
  • 그러나 배포 시 서버가 올라오지 않고 아래와 같은 에러 발생
[Error: ENOENT: no such file or directory, open '/var/app/current/.next/BUILD_ID'] {
errno: -2,
code: 'ENOENT',
syscall: 'open',
path: '/var/app/current/.next/BUILD_ID'
}

2. 해결

  • 배포 시 .next 폴더를 배포하지 않게 .gitignore에 포함했었음
  • 그러나 .next 폴더 관련한 에러 발생
  • .gitignore에서 .next를 제거해 배포되도록 함
  • 그리고 배포 전 build 함
  • build하면 .next/BUILD_ID 가 생성됨
  • .next 포함해서 배포 시 Elastic Beanstalk 에서 정상 동작 함
  • BUILD_ID가 없어서 발생한 문제

--

--

sig03
sig03

No responses yet