[RN-CheatSheet] Watchman error

HYUNGU, KANG·2023년 1월 30일
4

React-Native-CheatSheet

목록 보기
11/18

watchman 은 페이스북에서 만든, nodemon 이나 chokidar 처럼 파일단에서 변경사항이 발생했을 때 어떠한 작업을 하기 위한 용도의 프로그램이다.
때문에 설정 > 보안 및 개인 정보 보호 > 파일 및 폴더/디스크 접근 권한 같은 섹션에 들어가면, watchman 에 권한 허용이 필요한것을 볼 수 있다.

RN에서는 이를 사용해서, 작업 파일에 변경사항이 생겼을때 번들링을 다시 하거나 refresh 를 하는데 사용하고 있는것으로 짐작된다.

가끔씩 metro-bundler 서버를 실행시키면(yarn start) 아래와 같은 에러를 내뱉으면서 watchman 동작이 수행을 못하고 있다는 에러가 발생하는데

jest-haste-map: Watchman crawl failed. Retrying once with node crawler.
Usually this happens when watchman isn't running. Create an empty .watchmanconfig file in your project's root folder or initialize a git or hg repository in your project.
Error: Watchman error: std::__1::system_error: open: /Users/user/Desktop/project: Operation not permitted. Make sure watchman is running for this project. See https://facebook.github.io/watchman/docs/troubleshooting.

갑자기 이런다면, 보통 권한의 문제보다는 watchman 실행에 문제가 있는 경우가 대부분이다.
권한을 체크해보고 이상이 없다면, 아래의 명령어로 watchman 을 종료하고 재실행하면 문제가 대부분 해결된다.

$ watchman shutdown-server
$ watchman

만약 그래도 계속해서 문제가 지속된다면 재설치를 진행해주자.

$ watchman shutdown-server
$ brew update
$ brew reinstall watchman
$ watchman
profile
JavaScript, TypeScript and React-Native

4개의 댓글

comment-user-thumbnail
2023년 5월 24일

덕분에 해결했습니댜!! 지존자이십니다🙏

1개의 답글
comment-user-thumbnail
2023년 5월 24일

도움 많이 되었습니다 감사합니다 :)

1개의 답글