Bug: Watch mode on Linux causes a ENOSPC Node.js error
PC 를 끄기 전 까지 잘 동작하던 React Native 프로젝트를 다시 실행시키니 아래와 같은 에러가 발생한다.
[21:50:51] fs.js:1384 [21:50:51] throw error; [21:50:51] ^ [21:50:51] [21:50:51] Error: watch /home/mindyong/dyong-weather-app/node_modules/array-slice ENOSPC [21:50:51] at _errnoException (util.js:992:11) [21:50:51] at FSWatcher.start (fs.js:1382:19) [21:50:51] at Object.fs.watch (fs.js:1408:11) [21:50:51] at NodeWatcher.watchdir (/home/mindyong/dyong-weather-app/node_modules/sane/src/node_watcher.js:175:20) [21:50:51] at Walker.<anonymous> (/home/mindyong/dyong-weather-app/node_modules/sane/src/common.js:116:12) [21:50:51] at emitTwo (events.js:126:13) [21:50:51] at Walker.emit (events.js:214:7) [21:50:51] at /home/mindyong/dyong-weather-app/node_modules/walker/lib/walker.js:69:16 [21:50:51] at go$readdir$cb (/home/mindyong/dyong-weather-app/node_modules/graceful-fs/graceful-fs.js:162:14) [21:50:51] at FSReqWrap.oncomplete (fs.js:135:15) |
ENOSPC 에러는 "There is no space on the drive" 라는 의미이다.
하지만 포맷한지 한 달도 안된 나의 PC ..
아래 명령어로 확인해보니 용량은 넘쳐 흐른다.
mindyong@mindyong-desktop:~$ df -h Filesystem Size Used Avail Use% Mounted on udev 16G 0 16G 0% /dev tmpfs 3.2G 2.0M 3.2G 1% /run /dev/sda1 229G 19G 199G 9% / tmpfs 16G 18M 16G 1% /dev/shm tmpfs 5.0M 4.0K 5.0M 1% /run/lock tmpfs 16G 0 16G 0% /sys/fs/cgroup |
용량이 부족하지 않은데도 ENOSPC 가 발생할 경우 , 아래의 명령어로 이를 해결할 수 있다.
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p |
리눅스에서는 기본적으로 inotify를 사용하여 디렉토리에서 변경 사항을 모니터링하는데 파일 수의 limit이 걸려있다.
이를 무제한으로 풀어줌으로써 해결.
참고 사이트
https://stackoverflow.com/questions/22475849/node-js-what-is-enospc-error-and-how-to-solve/32600959#32600959
https://github.com/guard/listen/wiki/Increasing-the-amount-of-inotify-watchers#the-technical-details
'뚝딱뚝딱 > React' 카테고리의 다른 글
React Native 로 앱 만들기 (4) - React Native 의 컨셉 이해하기 (0) | 2018.12.18 |
---|---|
React Native 로 앱 만들기 (3) - Expo 설치하고 새 프로젝트 생성하기 (0) | 2018.12.16 |
React Native 로 앱 만들기 (2) - Expo 란? (0) | 2018.12.16 |
React Native 로 앱 만들기 (1) - React Native란? (0) | 2018.12.16 |