gh-pages 빌드 오류 시 확인 해야 할 것들
1.hompage의 주소가 맞는지 확인한다 (대소문자도 유의!)
package.json에
"homepage":"https://{github아이디}.github.io/{repository이름}"
필자는 repository 작성 시 대소문자 상관없을 줄 알고
레포지토리 twitterC를 twitterc로 작성하였다가 며칠을 고생하였다.. 복사해서 작성하도록!
2.setting > pages > branch를 gh-pages로 수정하기

3.< BrowserRouter basename={process.env.PUBLIC_URL} />작성
browserRotuer 사용 시에!
4.<HashRouter basename="/> 사용하기
github deployment에서는 BrowserRouter를 사용하지 않는걸 권장한다고 합니다.
(이슈가 좀 있다고 하네요) 그래서 무조건 HashRouter를 사용하는게 좋다고합니다.
https://stackoverflow.com/questions/68025460/react-app-deployment-on-github-pages-shows-a-blank-page
React app deployment on github pages shows a blank page
I'm just starting with react and I built my first application and now I'm trying to deploy it on github pages but the page is completely blank. The steps I followed are: Install gh-pages: npm inst...
stackoverflow.com
gh-pages readme가 나올 때
gh-pages 재설치
git repository에 branch를 gh-pages로 바꾸기
Deployment on GitHub Pages
Deploying to GitHub Pages is automatic. Once it’s set up, deploying happens whenever you push your local changes to your remote, GitHub-hosted repository. Head to GitHub Pages’ setup instructions and follow the steps exactly to get your main GitHub Pages page setup.
When you first navigate to your newly deployed site it is possible that you will receive a 404 error. If this happens, and you are confident that you have followed all the steps as written, check back in 30 minutes to see if the deploy has successfully gone through.
'코딩' 카테고리의 다른 글
깃헙 프로젝트 관리하기, 팀에 들어가기전 확인하면 좋을 글 (0) | 2023.04.04 |
---|---|
자바스크립트 동기? 비동기? (0) | 2023.03.04 |
트위터 클론 :4 Profile화면에서 내 트윗가져오기, user 정보 업데이트하기 (0) | 2023.03.02 |
트위터 클론코딩: 3 getServerSideProps(context),404page (0) | 2023.02.15 |
React component Life Cycle, useEffect Cleanup (0) | 2023.02.15 |