![](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbwxR1z%2FbtrjPPZH8id%2FKBDDIV8HJnVSzCeyWbwZEK%2Fimg.png)
[Next.js] ChunkLoadError: Loading chunk node_modules_next_dist_client_dev_noop_js failed
하수도키
·2021. 11. 3. 16:10
최근 백오피스 프로젝트를 맡게 되어서 next.js 를 도입했다.
인증 작업이 필요해 AWS cognito를 연동 도중에 에러가 발생했다.
에러
처음에는 Hosting UI 가 나오지 않고 잘못된 요청이라고 에러를 뿜어냈다.
aws-cognito-next 라이브러리를 설치 후 에러가 발생한것 같아서 문서 보면서 차근차근 따라가보면서 살펴봤다.
https://www.npmjs.com/package/aws-cognito-next
aws-cognito-next
Authentication helpers to enable usage of [AWS Cognito](https://aws.amazon.com/en/cognito/) in [next.js](https://nextjs.org/) applications.
www.npmjs.com
next.config.js 설정 및 코드 변경하고 로그도 찍어보다가 아래 이미지 처럼 에러가 발생했다.
좀 더 삽질을 하다가 에러 내용을 복사해서 구글링을 해보니 스택오버플로우에서 바로 해결법을 찾았다.
다양한 개발자들이 next.js cache문제 또는 page구조 변경 등과 같이 여러가지 이유를 추측했다.
해결법
- /.next folder 제거
- 서버 재실행
- 강력 새로 고침 브라우저
- 이래도 안되면 빌드된 폴더들을 다 지우고 2번에서 다시 시작
간만에 짬이나서 에러 보면서 공부하고 수정해보려고 했는데.......꽤 많은 시간과 스트레스를 소비했다.
결론
역시 구글링이 최고
인증 작업이 필요해 AWS cognito를 연동 도중에 에러가 발생했다.
참고
ChunkLoadError: Loading chunk node_modules_next_dist_client_dev_noop_js failed
I've been following the basics tutorial on the Next.js website and when I got to the Global Styles step, I started getting the follwing runtime error: ChunkLoadError: Loading chunk
stackoverflow.com