@@ -63,33 +63,30 @@ function run(onReady: () => ?any, options: Object = {}, isInteractive = false) {
6363 const projectDir = process . cwd ( ) ;
6464
6565 if ( process . platform !== 'win32' ) {
66- if ( process . platform === 'darwin' ) {
66+ const watchmanExists = spawn . sync ( 'which' , [ 'watchman' ] ) . status === 0 ;
67+
68+ if ( process . platform === 'darwin' && ! watchmanExists ) {
6769 const watcherDetails = spawn . sync ( 'sysctl' , [ 'kern.maxfiles' ] ) . stdout . toString ( ) ;
6870 if ( parseInt ( watcherDetails . split ( ':' ) [ 1 ] . trim ( ) ) < 5242880 ) {
6971 log . withTimestamp (
70- `
71- The number of files that can be watched is too low. Please set it to higher number.
72- Please use:
72+ `${ chalk . red ( `Unable to start server` ) }
73+ See https://git.io/v5vcn for more information, either install watchman or run the following snippet:
7374${ chalk . cyan ( ` sudo sysctl -w kern.maxfiles=5242880
7475 sudo sysctl -w kern.maxfilesperproc=524288` ) }
75- and start again.
7676 `
7777 ) ;
7878 process . exit ( 1 ) ;
7979 }
80- } else {
80+ } else if ( ! watchmanExists ) {
8181 const watcherDetails = spawn
8282 . sync ( 'sysctl' , [ 'fs.inotify.max_user_watches' ] )
8383 . stdout . toString ( ) ;
8484 if ( parseInt ( watcherDetails . split ( '=' ) [ 1 ] . trim ( ) ) < 12288 ) {
8585 log . withTimestamp (
86- `
87- The number of directories that can be watched is too low. Please set it to higher number.
88- Please use:
86+ `${ chalk . red ( `Unable to start server` ) }
87+ See https://git.io/v5vcn for more information, either install watchman or run the following snippet:
8988${ chalk . cyan ( ` sudo sysctl -w fs.inotify.max_user_instances=1024
90- sudo sysctl -w fs.inotify.max_user_watches=12288` ) }
91- and start again.
92- `
89+ sudo sysctl -w fs.inotify.max_user_watches=12288` ) } `
9390 ) ;
9491 process . exit ( 1 ) ;
9592 }
0 commit comments