Search code examples
androidreact-nativewatchman

ERR! code ELIFECYCLE while running npm start


I've run npm start, npm run start, sudo npm start and sudo npm run start, yarn start, sudo yarn start and am getting the same error:

Loading dependency graph...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: A non-recoverable condition has triggered.  Watchman needs your help!
The triggering condition was at timestamp=1507837337: inotify-add-watch(/home/mohammad/foobar_react_native/node_modules/is-arrayish) -> The user limit on the total number of inotify watches was reached; increase the fs.inotify.max_user_watches sysctl
All requests will continue to fail with this message until you resolve
the underlying problem.  You will find more information on fixing this at
https://facebook.github.io/watchman/docs/troubleshooting.html#poison-inotify-add-watch. Make sure watchman is running for this project. See https://facebook.github.io/watchman/docs/troubleshooting.html.
 ERROR  A non-recoverable condition has triggered.  Watchman needs your help!
The triggering condition was at timestamp=1507837337: inotify-add-watch(/home/mohammad/foobar_react_native/node_modules/is-arrayish) -> The user limit on the total number of inotify watches was reached; increase the fs.inotify.max_user_watches sysctl
All requests will continue to fail with this message until you resolve
the underlying problem.  You will find more information on fixing this at
https://facebook.github.io/watchman/docs/troubleshooting.html#poison-inotify-add-watch

Loading dependency graph...npm ERR! code ELIFECYCLE
npm ERR! errno 11
npm ERR! foobar_react_native@0.0.1 start: `node node_modules/react-native/local-cli/cli.js start`
npm ERR! Exit status 11
npm ERR! 
npm ERR! Failed at the foobar_react_native@0.0.1 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/mohammad/.npm/_logs/2017-10-12T19_42_19_386Z-debug.log

and here is the debug log:

 cat /home/mohammad/.npm/_logs/2017-10-12T19_43_55_751Z-debug.log
0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/usr/local/bin/npm', 'run', 'start' ]
2 info using npm@5.4.2
3 info using node@v8.5.0
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle foobar_react_native@0.0.1~prestart: foobar_react_native@0.0.1
6 info lifecycle foobar_react_native@0.0.1~start: foobar_react_native@0.0.1
7 verbose lifecycle foobar_react_native@0.0.1~start: unsafe-perm in lifecycle true
8 verbose lifecycle foobar_react_native@0.0.1~start: PATH: /usr/local/lib/node_modules/npm/bin/node-gyp-bin:/home/mohammad/foobar_react_native/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
9 verbose lifecycle foobar_react_native@0.0.1~start: CWD: /home/mohammad/foobar_react_native
10 silly lifecycle foobar_react_native@0.0.1~start: Args: [ '-c',
10 silly lifecycle   'node node_modules/react-native/local-cli/cli.js start' ]
11 silly lifecycle foobar_react_native@0.0.1~start: Returned: code: 11  signal: null
12 info lifecycle foobar_react_native@0.0.1~start: Failed to exec start script
13 verbose stack Error: foobar_react_native@0.0.1 start: `node node_modules/react-native/local-cli/cli.js start`
13 verbose stack Exit status 11
13 verbose stack     at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:280:16)
13 verbose stack     at emitTwo (events.js:125:13)
13 verbose stack     at EventEmitter.emit (events.js:213:7)
13 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack     at emitTwo (events.js:125:13)
13 verbose stack     at ChildProcess.emit (events.js:213:7)
13 verbose stack     at maybeClose (internal/child_process.js:927:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
14 verbose pkgid foobar_react_native@0.0.1
15 verbose cwd /home/mohammad/foobar_react_native
16 verbose Linux 4.10.0-32-generic
17 verbose argv "/usr/bin/node" "/usr/local/bin/npm" "run" "start"
18 verbose node v8.5.0
19 verbose npm  v5.4.2
20 error code ELIFECYCLE
21 error errno 11
22 error foobar_react_native@0.0.1 start: `node node_modules/react-native/local-cli/cli.js start`
22 error Exit status 11
23 error Failed at the foobar_react_native@0.0.1 start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 11, true ]

How can I fix this?

I've tried rm -rf node_modules && npm install.

I've tried

watchman watch-del-all
watchman shutdown-server

Here is my project directory:

drwxrwxr-x   9 mohammad mohammad   4096 Oct 12 15:49 .
drwxr-xr-x  48 mohammad mohammad   4096 Oct 12 00:47 ..
drwxrwxr-x   7 mohammad mohammad   4096 Oct 12 01:24 android
-rw-rw-r--   1 mohammad mohammad   1164 Oct 12 00:47 App.js
-rw-rw-r--   1 mohammad mohammad     75 Oct 12 00:47 app.json
-rw-rw-r--   1 mohammad mohammad     34 Oct 12 00:47 .babelrc
-rw-rw-r--   1 mohammad mohammad    114 Oct 12 00:47 .buckconfig
-rw-rw-r--   1 mohammad mohammad   1445 Oct 12 00:47 .flowconfig
drwxrwxr-x   2 mohammad mohammad   4096 Oct 12 01:08 gen
drwxrwxr-x   8 mohammad mohammad   4096 Oct 12 15:42 .git
-rw-rw-r--   1 mohammad mohammad     16 Oct 12 00:47 .gitattributes
-rw-rw-r--   1 mohammad mohammad    763 Oct 12 00:47 .gitignore
drwxrwxr-x   3 mohammad mohammad   4096 Oct 12 15:30 .idea
-rw-rw-r--   1 mohammad mohammad    135 Oct 12 00:47 index.js
drwxrwxr-x   7 mohammad mohammad   4096 Oct 12 00:47 ios
drwxrwxr-x 575 mohammad mohammad  20480 Oct 12 15:49 node_modules
-rw-rw-r--   1 mohammad mohammad    450 Oct 12 15:49 package.json
-rw-rw-r--   1 mohammad mohammad 209155 Oct 12 15:49 package-lock.json
drwxrwxr-x   2 mohammad mohammad   4096 Oct 12 00:47 __tests__
-rw-rw-r--   1 mohammad mohammad      2 Oct 12 00:47 .watchmanconfig
-rw-rw-r--   1 mohammad mohammad 157444 Oct 12 00:47 yarn.lock

watchman version: 4.7.0

react-native versions:

react-native-cli: 2.0.1 react-native: 0.49.3

.watchmanconfig file:

{}

Can anyone tell me how to fix it?


Solution

  • Resolved by running:


    sudo npm install -g watchman
    sudo npm run start