Netlify Build 실패

kkambo·2023년 12월 31일
1

문제상황

팀원에게 Netlify depoly를 폴더가 아닌 github 연동하는 방법을 설명해주면서 Build 에서 에러 발생, 왜 그런지 고민이 들던 중 로그를 한번 까보기로 했다.

4:28:27 PM: **Netlify Build**
4:28:27 PM: **────────────────────────────────────────────────────────────────**
4:28:27 PM: ****
4:28:27 PM: **❯ Version**
4:28:27 PM:   @netlify/build 29.31.1
4:28:27 PM: ****
4:28:27 PM: **❯ Flags**
4:28:27 PM:   baseRelDir: true
4:28:27 PM:   buildId: 65911801aadc4a0008817ec2
4:28:27 PM:   deployId: 65911801aadc4a0008817ec4
4:28:27 PM: ****
4:28:27 PM: **❯ Current directory**
4:28:27 PM:   /opt/build/repo
4:28:27 PM: ****
4:28:27 PM: **❯ Config file**
4:28:27 PM:   No config file was defined: using default values.
4:28:27 PM: ****
4:28:27 PM: **❯ Context**
4:28:27 PM:   production
4:28:27 PM: ****
4:28:27 PM: **Build command from Netlify app**
4:28:27 PM: **────────────────────────────────────────────────────────────────**
4:28:27 PM: 
4:28:27 PM: $ npm run build
4:28:28 PM: > 1-weekly-mission@0.1.0 build
4:28:28 PM: > react-scripts build
4:28:29 PM: Creating an optimized production build...
4:28:32 PM: One of your dependencies, babel-preset-react-app, is importing the
4:28:32 PM: "@babel/plugin-proposal-private-property-in-object" package without
4:28:32 PM: declaring it in its dependencies. This is currently working because
4:28:32 PM: "@babel/plugin-proposal-private-property-in-object" is already in your
4:28:32 PM: node_modules folder for unrelated reasons, but it **may break at any time**.
4:28:32 PM: babel-preset-react-app is part of the create-react-app project, **which**
**4:28:32 PM: is not maintianed anymore**. It is thus unlikely that this bug will
4:28:32 PM: ever be fixed. Add "@babel/plugin-proposal-private-property-in-object" to
4:28:32 PM: your devDependencies to work around this error. This will make this message
4:28:32 PM: go away.
4:28:33 PM:
4:28:33 PM: Treating warnings as errors because process.env.CI = true.
4:28:33 PM: Most CI servers set it automatically.
4:28:33 PM:
4:28:33 PM: Failed to compile.
4:28:33 PM:
4:28:33 PM: Warning
4:28:33 PM: (3:3) autoprefixer: start value has mixed support, consider using flex-start instead
4:28:33 PM: ****
4:28:33 PM: **"build.command" failed**
4:28:33 PM: **────────────────────────────────────────────────────────────────**
4:28:33 PM: 
4:28:33 PM:   **Error message**
4:28:33 PM:   Command failed with exit code 1: npm run build (**https://ntl.fyi/exit-code-1**)
4:28:33 PM: 
4:28:33 PM:   **Error location**
4:28:33 PM:   In Build command from Netlify app:
4:28:33 PM:   npm run build
4:28:33 PM: 
4:28:33 PM:   **Resolved config**
4:28:33 PM:   build:
4:28:33 PM:     command: npm run build
4:28:33 PM:     commandOrigin: ui
4:28:33 PM:     publish: /opt/build/repo/build
4:28:33 PM:     publishOrigin: ui
4:28:34 PM: Failed during stage "building site": Build script returned non-zero exit code: 2
4:28:34 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
4:28:34 PM: Failing build: Failed to build site
4:28:34 PM: Finished processing build request in 31.418s

해결

솔직히 나는 아는게 없기 때문에 의심스러운 부분을 구글 번역기나 검색을 돌려보았다.
그 중

Failed to compile.
Warning
(3:3) autoprefixer: start value has mixed support, consider using flex-start instead

라는 부분을 찾았다. 혹시 css에서 flex-start말고 start를 사용한 부분이 있는지 확인요청했고 해당 부분을 수정한 후 정상적으로 build 됨을 확인하였다.

그리고

Treating warnings as errors because process.env.CI = true.

이부분 때문에 Warning 임에도 error로 처리되어 build가 중지된다는 내용도 추가 확인하였다.

profile
5년 넘게 다니던 직장 정리하고 프론트엔드 취업에 도전

1개의 댓글

깜보님 덕분에 시원하게 해결봤어요 https://velog.io/@ooo3289/Netlify-build-오류-해결법

답글 달기