본문 바로가기
개발

flutter upgrade 할때 만난 에러메시지

by GreatCoding 2023. 9. 2.

회사에서 뿐만 아니라 개인적으로도 React Native를 주력으로 사용했지만, React Native를 사용할때 항상 아쉬운 점이 버전 업그레이드를 할때였다.

오죽하면 https://react-native-community.github.io/upgrade-helper/ 와 같은 업그레이드를 도와주는 커뮤니티 도구까지 따로 있을까.

 

물론 플러터도 다트 언어에 Null Safety가 들어가면서 마이그레이션 툴을 따로 실행해야 했지만, 그때를 제외하곤 버전업의 난이도가 훨씬 낮은것도 사실이다.

 

간만에 버전업을 하기 위하여 flutter upgrade 명령어를 입력하였는데 아래와 같은 메시지를 만났다.

 

Unknown flutter tag. Abandoning upgrade to avoid destroying local changes. It is recommended to use git directly if not working on an official channel.

 

설치된 플러터 코드가 건들여졌을 확률이 높다. IDE에서 코드를 타고 들어가다 내가 건들였거나, https://shorebird.dev/ 와 같이 플러터 코드에 직접 손을 대는것을 사용했거나.

 

내 프로젝트가 아닌, 설치된 플러터 소스 코드를 초기화 해도 되는 경우라면

flutter upgrade --force

명령어로 쉽게 업그레이드가 가능하다.

 

추가 : 글 작성 당시는 맥환경에서 위와 같은 메시지를 만났고, 추후 윈도우 환경에서 시도해보니 아래와 같이 좀 더 명시적으로 --force를 사용하라고 안내해준다. (OS와 관계없이 소스 상태나 버전에 의한 환경탓일 수도 있다.)

Your flutter checkout has local changes that would be erased by upgrading. If you want to keep these changes, it is recommended that you stash them via "git stash" or else commit the changes to a local branch. If it is okay to remove local changes, then re-run this command with "--force".

댓글