Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 |
Tags
- map
- array
- npm에러
- async
- reactnative error
- set
- 슬라이딩윈도우
- forwardref type
- interface
- app:compiledebugkotlin
- 이진탐색
- react
- extends
- Next.js
- TS
- materialicons
- 상속
- app.post
- generic
- 타입스크립트
- 안드로이드빌드에러
- 리액트네이티브아이콘
- Filter
- err_connection_refused
- reactnative
- Spring
- 스크롤이벤트
- javascript
- mainapplication.kt
- 배열중복요소제거
Archives
- Today
- Total
rhanziy
리액트 프로젝트 git 배포 본문
https://cocoon1787.tistory.com/831
1. git 저장소 생성
2. 올릴 리액트 프로젝트 터미널에 차례대로 작성
git init // 프로젝트에 git 설치
git add -A // 해당 프로젝트 폴더 내의 파일 전부 올리기
git commit -m "first commit" // commit 메시지 작성
git remote add origin https://github.com/K-Junyyy/Portfolio.git // 원격저장소 설정
git push origin master // master로 push
3. npm install gh-pages --save 프로젝트에 gh-pages 설치
4. package.json파일에
"scripts": { //...
"predeploy" : "npm run build",
"deploy" : "gh-pages -d build"
}
맨 하단 hompage추가
"homepage": "https://깃허브계정이름.github.io/레포지토리이름/"
5. npm run deploy 실행
6. 레포지토리 setting-pages에서 브랜치를 gh-pages로 변경
잘 안될 때 체크리스트
- homepage 주소 맨 뒤에 ("/")를 입력하였는지
- 레포지토리는 public으로 설정되었는지
- remote add로 원격 저장소와 연결하였는지
- gh-pages 브랜치에 build 파일이 올라가 있는지
- 배포 후 바로 접속하면 흰 화면에 404 에러 발생. 배포 후 페이지 뜨는데 시간이 좀 걸림(필자의 경우 3~5분)
- 그래도 안된다면 npm run deploy 한번 더 실행
BrowserRouter 사용 시 basename 사용
<BrowserRouter basename={process.env.PUBLIC_URL}>
'git' 카테고리의 다른 글
git error: unable to delete [BRANCH NAME] : remote ref does not exist (0) | 2021.12.20 |
---|---|
git 브랜치 (1) | 2021.12.17 |
Comments