본문 바로가기

Computer Science/React

[react.js] deploy 에러

# Deploy 에러



빌드까지 마치고 npm run deploy를 했는데!


이러한 에러가 났다.



npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! my-app@0.1.0 deploy: gh-pages -d build
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the my-app@0.1.0 deploy script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\hyunsoo\AppData\Roaming\npm-cache_logs\2018-07-17T09_05_43_293Z-debug.log




해결책은 현재 working directory에 있는 remote 저장소의 주소가 아직 설정되지 않아서 그런것!

 


# Solution


<git에 있는 working directory에 새로운 remote 저장소를 추가 하여야 한다.>


1. 새로운 git repository를 만드시고 해당 repository의 giturl을 가져온다. 


2. 명령어 입력 => "git remote add origin 가져온 giturl"


3. 다시 npm run deploy



*주의사항*


빈 repo에 위 과정을 수행한다면, gh-pages의 브랜치가 만들어지고 gh-pages의 파일만 올라가게 되므로

혹시 원래의 소스코드를 올리고 싶다면 따로 git push로 올려야 함(master)