• 로그인
  • 장바구니에 상품이 없습니다.

home2 게시판 Next.js 게시판 AWS 배포 에러문제

AWS 배포 에러문제

3 글 보임 - 1 에서 3 까지 (총 3 중에서)
  • 글쓴이
  • #119969

    신혜진
    참가자
    안녕하세요. 올려주신 NEXT.JS 강의 중 AWS 배포과정에서 에러 해결을 어떻게 해야 할지 모르겠습니다.
    일단, 알려주신대로 모든 세팅을 마쳤고, 다만 다른 점이라고 하면 인스턴트를 설정하는 단계에서 t2.micro가 보이지 않아, t3.micro로 선택하였습니다.
    파일을 업로드하여 배포를 진행하는 중 에러 관련 스샷은 아래와 같습니다.
    Screenshot 2024-04-12 at 5.30.46 PM
    
    해당 에러에는 
    4월 12, 2024 16:58:39 (UTC+9)
    Instance deployment: 'npm' failed to install dependencies that you defined in 'package.json'. For details, see 'eb-engine.log'. The deployment failed.
    이므로, 아래 eb-engine.log 이 이렇게 나와있습니다.
    
    /var/log/eb-engine.log
    ----------------------------------------
    2024/04/12 07:58:36.187740 [INFO] Executing platform hooks in .platform/hooks/prebuild/
    2024/04/12 07:58:36.187754 [INFO] The dir .platform/hooks/prebuild/ does not exist
    2024/04/12 07:58:36.187756 [INFO] Finished running scripts in /var/app/staging/.platform/hooks/prebuild
    2024/04/12 07:58:36.187761 [INFO] Executing instruction: Install customer specified node.js version
    2024/04/12 07:58:36.187855 [INFO] Executing instruction: Use NPM to install dependencies
    2024/04/12 07:58:36.187864 [INFO] use npm to install dependencies
    2024/04/12 07:58:36.187883 [INFO] Getting npm verison
    2024/04/12 07:58:36.187891 [INFO] Running command /bin/sh -c npm --version
    2024/04/12 07:58:37.326442 [INFO] 9.8.1
    2024/04/12 07:58:37.326474 [INFO] Using npm v9
    2024/04/12 07:58:37.326486 [INFO] Running command /bin/su webapp -c npm --omit=dev install
    2024/04/12 07:58:39.814899 [INFO] npm notice 
    npm notice New major version of npm available! 9.8.1 -> 10.5.2
    npm notice Changelog: <https://github.com/npm/cli/releases/tag/v10.5.2>
    npm notice Run `npm install -g npm@10.5.2` to update!
    npm notice 
    npm ERR! code ERESOLVE
    npm ERR! ERESOLVE could not resolve
    npm ERR! 
    npm ERR! While resolving: @next-auth/mongodb-adapter@1.1.3
    npm ERR! Found: mongodb@6.5.0
    npm ERR! node_modules/mongodb
    npm ERR!   mongodb@"^6.5.0" from the root project
    npm ERR! 
    npm ERR! Could not resolve dependency:
    npm ERR! peer mongodb@"^5 || ^4" from @next-auth/mongodb-adapter@1.1.3
    npm ERR! node_modules/@next-auth/mongodb-adapter
    npm ERR!   @next-auth/mongodb-adapter@"^1.1.3" from the root project
    npm ERR! 
    npm ERR! Conflicting peer dependency: mongodb@5.9.2
    npm ERR! node_modules/mongodb
    npm ERR!   peer mongodb@"^5 || ^4" from @next-auth/mongodb-adapter@1.1.3
    npm ERR!   node_modules/@next-auth/mongodb-adapter
    npm ERR!     @next-auth/mongodb-adapter@"^1.1.3" from the root project
    npm ERR! 
    npm ERR! Fix the upstream dependency conflict, or retry
    npm ERR! this command with --force or --legacy-peer-deps
    npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
    npm ERR! 
    npm ERR! 
    npm ERR! For a full report see:
    npm ERR! /home/webapp/.npm/_logs/2024-04-12T07_58_38_226Z-eresolve-report.txt
    npm ERR! A complete log of this run can be found in: /home/webapp/.npm/_logs/2024-04-12T07_58_38_226Z-debug-0.log
    2024/04/12 07:58:39.814931 [ERROR] An error occurred during execution of command [app-deploy] - [Use NPM to install dependencies]. Stop running the command. Error: Command /bin/su webapp -c npm --omit=dev install failed with error exit status 1. Stderr:npm notice 
    npm notice New major version of npm available! 9.8.1 -> 10.5.2
    npm notice Changelog: <https://github.com/npm/cli/releases/tag/v10.5.2>
    npm notice Run `npm install -g npm@10.5.2` to update!
    npm notice 
    npm ERR! code ERESOLVE
    npm ERR! ERESOLVE could not resolve
    npm ERR! 
    npm ERR! While resolving: @next-auth/mongodb-adapter@1.1.3
    npm ERR! Found: mongodb@6.5.0
    npm ERR! node_modules/mongodb
    npm ERR!   mongodb@"^6.5.0" from the root project
    npm ERR! 
    npm ERR! Could not resolve dependency:
    npm ERR! peer mongodb@"^5 || ^4" from @next-auth/mongodb-adapter@1.1.3
    npm ERR! node_modules/@next-auth/mongodb-adapter
    npm ERR!   @next-auth/mongodb-adapter@"^1.1.3" from the root project
    npm ERR! 
    npm ERR! Conflicting peer dependency: mongodb@5.9.2
    npm ERR! node_modules/mongodb
    npm ERR!   peer mongodb@"^5 || ^4" from @next-auth/mongodb-adapter@1.1.3
    npm ERR!   node_modules/@next-auth/mongodb-adapter
    npm ERR!     @next-auth/mongodb-adapter@"^1.1.3" from the root project
    npm ERR! 
    npm ERR! Fix the upstream dependency conflict, or retry
    npm ERR! this command with --force or --legacy-peer-deps
    npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
    npm ERR! 
    npm ERR! 
    npm ERR! For a full report see:
    npm ERR! /home/webapp/.npm/_logs/2024-04-12T07_58_38_226Z-eresolve-report.txt
    npm ERR! A complete log of this run can be found in: /home/webapp/.npm/_logs/2024-04-12T07_58_38_226Z-debug-0.log
    
    2024/04/12 07:58:39.814936 [INFO] Executing cleanup logic
    2024/04/12 07:58:39.815236 [INFO] CommandService Response: {"status":"FAILURE","api_version":"1.0","results":[{"status":"FAILURE","msg":"Engine execution has encountered an error.","returncode":1,"events":[{"msg":"Instance deployment: 'npm' failed to install dependencies that you defined in 'package.json'. For details, see 'eb-engine.log'. The deployment failed.","timestamp":1712908719814,"severity":"ERROR"},{"msg":"Instance deployment failed. For details, see 'eb-engine.log'.","timestamp":1712908719815,"severity":"ERROR"}]}]}
    2024/04/12 07:58:39.815470 [INFO] Platform Engine finished execution on command: app-deploy
    2024/04/12 08:24:18.839024 [INFO] Starting...
    2024/04/12 08:24:18.839072 [INFO] Starting EBPlatform-PlatformEngine
    2024/04/12 08:24:18.839102 [INFO] reading event message file
    2024/04/12 08:24:18.840422 [INFO] Engine received EB command cfn-hup-exec
    2024/04/12 08:24:18.925007 [INFO] Running command /bin/sh -c /opt/aws/bin/cfn-get-metadata -s arn:aws:cloudformation:ap-northeast-2:381491830937:stack/awseb-e-2embfvzby2-stack/4bd0f580-f8a2-11ee-9db4-02c8f02692fd -r AWSEBAutoScalingGroup --region ap-northeast-2
    2024/04/12 08:24:19.250180 [INFO] Running command /bin/sh -c /opt/aws/bin/cfn-get-metadata -s arn:aws:cloudformation:ap-northeast-2:381491830937:stack/awseb-e-2embfvzby2-stack/4bd0f580-f8a2-11ee-9db4-02c8f02692fd -r AWSEBBeanstalkMetadata --region ap-northeast-2
    2024/04/12 08:24:19.584276 [INFO] checking whether command tail-log is applicable to this instance...
    2024/04/12 08:24:19.584291 [INFO] this command is applicable to the instance, thus instance should execute command
    2024/04/12 08:24:19.584294 [INFO] Engine command: (tail-log)
    2024/04/12 08:24:19.584343 [INFO] Executing instruction: GetTailLogs
    2024/04/12 08:24:19.584346 [INFO] Tail Logs...
    2024/04/12 08:24:19.584944 [INFO] Running command /bin/sh -c tail -n 100 /var/log/eb-engine.log
    ----------------------------------------
    /var/log/eb-hooks.log
    ----------------------------------------
    
    
    현재 node와 npm을 완전삭제 후 재 설치 하였는데, 다음 단계를 어떻게 진행해야 할지 모르겠습니다. ㅠㅠ
    #119991

    codingapple
    키 마스터
    npm install mongodb@5로 5버전 설치해서 올려봅시다
    #120025

    신혜진
    참가자
    몽고디비5버전 설치후에도 에러가 발생해서 다시 로그파일을 열어보았습니다.
    /var/log/eb-engine.log
    ----------------------------------------
    npm notice New minor version of npm available! 10.2.4 -> 10.5.2
    npm notice Changelog: <https://github.com/npm/cli/releases/tag/v10.5.2>
    npm notice Run `npm install -g npm@10.5.2` to update!
    npm notice 
    npm ERR! code ERESOLVE
    npm ERR! ERESOLVE could not resolve
    npm ERR! 
    npm ERR! While resolving: next-auth@4.21.1
    npm ERR! Found: next@14.1.4
    npm ERR! node_modules/next
    npm ERR!   next@"14.1.4" from the root project
    npm ERR! 
    npm ERR! Could not resolve dependency:
    npm ERR! peer next@"^12.2.5 || ^13" from next-auth@4.21.1
    npm ERR! node_modules/next-auth
    npm ERR!   next-auth@"^4.21.1" from the root project
    npm ERR!   peer next-auth@"^4" from @next-auth/mongodb-adapter@1.1.3
    npm ERR!   node_modules/@next-auth/mongodb-adapter
    npm ERR!     @next-auth/mongodb-adapter@"^1.1.3" from the root project
    npm ERR! 
    npm ERR! Conflicting peer dependency: next@13.5.6
    npm ERR! node_modules/next
    npm ERR!   peer next@"^12.2.5 || ^13" from next-auth@4.21.1
    npm ERR!   node_modules/next-auth
    npm ERR!     next-auth@"^4.21.1" from the root project
    npm ERR!     peer next-auth@"^4" from @next-auth/mongodb-adapter@1.1.3
    npm ERR!     node_modules/@next-auth/mongodb-adapter
    npm ERR!       @next-auth/mongodb-adapter@"^1.1.3" from the root project
    
    넥스트 버전과 충돌이 난다는 것을 발견하고 forum 폴더에서 터미널 열고 npm install next@13.5.6 --force 해주었습니다.
    다시 rpm run build 후, node_modules폴더를 제외한 나머지 전체파일을 압축해서 재업로드 했더니 OK 되었습니다.
    
    감사합니다!
3 글 보임 - 1 에서 3 까지 (총 3 중에서)
  • 답변은 로그인 후 가능합니다.

About

현재 월 700명 신규수강중입니다.

  (09:00~20:00) 빠른 상담은 카톡 플러스친구 코딩애플 (링크)
  admin@codingapple.com
  이용약관
ⓒ Codingapple, 강의 예제, 영상 복제 금지
top

© Codingapple, All rights reserved. 슈퍼로켓 에듀케이션 / 서울특별시 강동구 고덕로 19길 30 / 사업자등록번호 : 212-26-14752 온라인 교육학원업 / 통신판매업신고번호 : 제 2017-서울강동-0002 호 / 개인정보관리자 : 박종흠