하루 기록

[Error] Could not move temporary workspace 본문

React Native

[Error] Could not move temporary workspace

떼굴펜 2024. 10. 18. 13:15

에러 메세지

FAILURE: Build failed with an exception.

* What went wrong:
java.io.UncheckedIOException: Could not move temporary workspace (C:\Users\happy\project\mobile\android\.gradle\8.6\dependencies-accessors\423f0288fa7dffe069445ffa4b72952b4629a15a-c6373ed8-1955-4558-9396-8e5b76b1e878) to immutable location (C:\Users\happy\project\mobile\android\.gradle\8.6\dependencies-accessors\423f0288fa7dffe069445ffa4b72952b4629a15a)
> Could not move temporary workspace (C:\Users\happy\project\mobile\android\.gradle\8.6\dependencies-accessors\423f0288fa7dffe069445ffa4b72952b4629a15a-c6373ed8-1955-4558-9396-8e5b76b1e878) to immutable location (C:\Users\happy\project\mobile\android\.gradle\8.6\dependencies-accessors\423f0288fa7dffe069445ffa4b72952b4629a15a)

 

참고❗) 구글링해보면 대부분 gradle 버전을 업/다운그레이드하라고 했으나,

내 상황에서는 버전 상관없이 계속 문제가 생겼다. (8.6버전 사용중)

 

1. 일단 다른 건 OK인지 확인해보자 

npx react-native doctor

Metro 는 에뮬레이터를 안킨 상태면 저렇게 warning 으로 띄운다.

 

 

2. gradle 캐시, 이전 빌드 삭제

rm -rf android/.gradle
rm -rf android/build

묻지도 따지지도 말고 걍 삭제하는 옵션(-rf)이기에 프로젝트, 폴더 위치 잘 보고 실행하자

 

3. gradle 설정 초기화

cd android
./gradlew clean

 

이제 다시 start 해보면 해결된 모습을 볼 수 있다.

(안되면 start할 때 --reset-cache 옵션을 사용해보세요)

yarn run start 

 

 

 

 

참고 링크

- https://github.com/gradle/gradle/issues/27844

- https://github.com/facebook/react-native/issues/46046

- https://github.com/facebook/react-native/issues/46210

'React Native' 카테고리의 다른 글

Component 의 종류  (1) 2024.10.16