React Native fb-watchman 에러 발생 시

에러 메시지

node:events:491
      throw er; // Unhandled 'error' event
      ^

Error: std::__1::system_error: open: /.../planeat: Operation not permitted
    at BunserBuf.<anonymous> (/.../node_modules/fb-watchman/index.js:99:23)
    at BunserBuf.emit (node:events:513:28)
    at BunserBuf.process (/.../node_modules/bser/index.js:292:10)
    at /.../planeat/node_modules/bser/index.js:247:12
    at process.processTicksAndRejections (node:internal/process/task_queues:77:11)
Emitted 'error' event on WatchmanWatcher instance at:
    at Client.<anonymous> (/.../node_modules/metro-file-map/src/watchers/WatchmanWatcher.js:114:10)
    at Client.emit (node:events:513:28)
    at BunserBuf.<anonymous> (/.../planeat/node_modules/fb-watchman/index.js:111:12)
    at BunserBuf.emit (node:events:513:28)
    at /.../node_modules/bser/index.js:249:12
    at process.processTicksAndRejections (node:internal/process/task_queues:77:11) {
  watchmanResponse: {
    error: 'std::__1::system_error: open: /...: Operation not permitted',
    version: '2022.12.12.00'
  }
}

원인

macOS의 보안 제한 사항으로 watchman이 디스크 엑세스 권한을 받지 못한 상태

해결

$ watchman watch-del-all
$ watchman shutdown-server

터미널에서 위 두 명령을 실행하고, 다시 빌드해보면 watchman에게 디스크 권한을 줄지 물어보는 창이 나타나고, 수락해주면 문제 해결

1개의 좋아요