Heroku 배포

jangky000·2020년 8월 31일
0

Heroku 배포

https://nhj12311.tistory.com/276 참고

// 이미 git으로 작업 중이었다면
// heroku cli 다운로드
// 포트 설정 확인
heroku login
cd 프로젝트 위치
heroku git:remote -a 앱이름 // 프로젝트의 git을 remote로 등록
git push heroku HEAD:master // push, 이후 업데이트 시 이 명령만 사용하면 됨
heroku open // 창 열기
heroku logout

에러

// 1. git push heroku master를 사용할 때 에러 발생
// error: src refspec master does not match any. 
// error: failed to push some refs to 'https://git.heroku.com/week1airbnb.git'

// 2. npm start가 없다는 에러

// 3. 에러 발생
// Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch

해결

//1. https://stackoverflow.com/questions/26595874/i-want-make-push-and-get-error-src-refspec-master-does-not-match-any
// push에서 오류가 발생하는데 명령어가 조금 바뀌었다
git push heroku HEAD:master

// 2. package.json에서 scripts: {"start":"node index.js", } // "start":"node index.js" 추가

// 3. 
// https://stackoverflow.com/questions/15693192/heroku-node-js-error-web-process-failed-to-bind-to-port-within-60-seconds-of
// Heroku는 앱에 동적으로 포트를 할당하므로 포트를 고정 번호로 설정할 수 없습니다.
.listen(process.env.PORT || 5000)
profile
예비 웹 FE 개발자

0개의 댓글