[Ubuntu 19.04] Error: ENOSPC: System limit for number of file watchers reached

this is my second time using npm at all and when i type
npm start
to run my “react project” i got

Error: ENOSPC: System limit for number of file watchers reached, watch ‘/home/abdullah/Desktop/react project/test2/public’
at FSWatcher.start (internal/fs/watchers.js:165:26)
at Object.watch (fs.js:1258:11)
at createFsWatchInstance (/home/abdullah/Desktop/react project/test2/node_modules/chokidar/lib/nodefs-handler.js:38:15)
at setFsWatchListener (/home/abdullah/Desktop/react project/test2/node_modules/chokidar/lib/nodefs-handler.js:81:15)
at FSWatcher.NodeFsHandler._watchWithNodeFs (/home/abdullah/Desktop/react project/test2/node_modules/chokidar/lib/nodefs-handler.js:233:14)
at FSWatcher.NodeFsHandler._handleDir (/home/abdullah/Desktop/react project/test2/node_modules/chokidar/lib/nodefs-handler.js:429:19)
at FSWatcher. (/home/abdullah/Desktop/react project/test2/node_modules/chokidar/lib/nodefs-handler.js:477:19)
at FSWatcher. (/home/abdullah/Desktop/react project/test2/node_modules/chokidar/lib/nodefs-handler.js:482:16)
at FSReqWrap.oncomplete (fs.js:154:5)
Emitted ‘error’ event at:
at FSWatcher._handleError (/home/abdullah/Desktop/react project/test2/node_modules/chokidar/index.js:260:10)
at createFsWatchInstance (/home/abdullah/Desktop/react project/test2/node_modules/chokidar/lib/nodefs-handler.js:40:5)
at setFsWatchListener (/home/abdullah/Desktop/react project/test2/node_modules/chokidar/lib/nodefs-handler.js:81:15)
[… lines matching original stack trace …]
at FSReqWrap.oncomplete (fs.js:154:5)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! test2@0.1.0 start: react-scripts start
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the test2@0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /home/abdullah/.npm/_logs/2019-10-24T19_37_26_173Z-debug.log

OS: ubuntu 19.04

detailed log:

0 info it worked if it ends with ok

1 verbose cli [ ‘/usr/local/bin/node’, ‘/usr/local/bin/npm’, ‘start’ ]

2 info using npm@6.9.0

3 info using node@v10.16.3

4 verbose run-script [ ‘prestart’, ‘start’, ‘poststart’ ]

5 info lifecycle test2@0.1.0~prestart: test2@0.1.0

6 info lifecycle test2@0.1.0~start: test2@0.1.0

7 verbose lifecycle test2@0.1.0~start: unsafe-perm in lifecycle true

8 verbose lifecycle test2@0.1.0~start: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/abdullah/Desktop/react project/test2/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/abdullah/Library/Python/2.7/bin:/home/abdullah/Library/Python/2.7/bin:/home/abdullah/flutter/flutter/bin:/home/abdullah/nodejs/node-v10.16.3-linux-x64/bin:/usr/lib/dart/bin:/home/abdullah/.pub-cache/bin:/home/abdullah/.cargo/bin:/home/abdullah/.fzf/bin:/usr/local/go/bin:/home/abdullah/go/bin:/home/abdullah/Library/Python/2.7/bin

9 verbose lifecycle test2@0.1.0~start: CWD: /home/abdullah/Desktop/react project/test2

10 silly lifecycle test2@0.1.0~start: Args: [ ‘-c’, ‘react-scripts start’ ]

11 silly lifecycle test2@0.1.0~start: Returned: code: 1 signal: null

12 info lifecycle test2@0.1.0~start: Failed to exec start script

13 verbose stack Error: test2@0.1.0 start: react-scripts start

13 verbose stack Exit status 1

13 verbose stack at EventEmitter. (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:301:16)

13 verbose stack at EventEmitter.emit (events.js:198:13)

13 verbose stack at ChildProcess. (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)

13 verbose stack at ChildProcess.emit (events.js:198:13)

13 verbose stack at maybeClose (internal/child_process.js:982:16)

13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)

14 verbose pkgid test2@0.1.0

15 verbose cwd /home/abdullah/Desktop/react project/test2

16 verbose Linux 5.0.0-32-generic

17 verbose argv “/usr/local/bin/node” “/usr/local/bin/npm” “start”

18 verbose node v10.16.3

19 verbose npm v6.9.0

20 error code ELIFECYCLE

21 error errno 1

22 error test2@0.1.0 start: react-scripts start

22 error Exit status 1

23 error Failed at the test2@0.1.0 start script.

23 error This is probably not a problem with npm. There is likely additional logging output above.

24 verbose exit [ 1, true ]

Thanks for the details. Typing npm start is a shortcut for npm run start and will run the “script” called “start” defined in your package.json. In this case it is calling react-scripts start which is failing.

You can run the command directly to check that the problem occurs without npm involved:

./node_modules/.bin/react-scripts start
1 Like

Thank you for the quick response I will check that out

It was an inotify watchers issue it turns out it’s quite popular issue for more details check this out https://github.com/guard/listen/wiki/Increasing-the-amount-of-inotify-watchers#the-technical-details

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.