Create-react-native-app: 'Unable to start server' on npm start on create-react-native-app

Created on 17 Jan 2018  Â·  12Comments  Â·  Source: expo/create-react-native-app

Description

Created react native app using create-react-native-app and error on when run npm start in the app folder

Expected Behavior

To start the app and show QR code which a mobile can connect through expo app.

Observed Behavior

What actually happened when you performed the above actions?

If there's an error message, please paste the full terminal output and error message in this code block:

> [email protected] start /home/pankaja/Documents/Projects/react-native/whyerrors
> react-native-scripts start

5:24:24 PM: Unable to start server
  See https://git.io/v5vcn for more information, either install watchman or run the following snippet:
    sudo sysctl -w fs.inotify.max_user_instances=1024
    sudo sysctl -w fs.inotify.max_user_watches=12288

npm ERR! Linux 4.13.0-25-generic
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "start"
npm ERR! node v6.11.4
npm ERR! npm  v3.5.2
npm ERR! code ELIFECYCLE
npm ERR! [email protected] start: `react-native-scripts start`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] start script 'react-native-scripts start'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the whyerrors package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     react-native-scripts start
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs whyerrors
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls whyerrors
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /home/pankaja/Documents/Projects/react-native/whyerrors/npm-debug.log

Environment

Please run these commands in the project folder and fill in their results:

Also specify:

  1. Operating system: Ubuntu 17.10
  2. Phone/emulator/simulator & version: not relevant

Reproducible Demo

Most helpful comment

Just type following commands to fix it if you don't wanna install Watchman

sudo sysctl -w fs.inotify.max_user_instances=1024
sudo sysctl -w fs.inotify.max_user_watches=12288

All 12 comments

I'm getting the same error. With slightly newer node and npm versions:

node -v: v8.9.4 (latest active LTS version, Carbon)
npm -v: 4.2.0

And I also got the same error with:

node -v: v9.4.0 (latest node version)
npm -v: 4.6.1 (latest version before version 5 which create-react-native-app doesn't support yet)

On: macOS High Sierra 10.13.2

Description

Created react native app using create-react-native-app and error on when run npm start in the app folder

Expected behavior

To start the app and show QR code which a mobile can connect through expo app.

Observed behavior

[14:48:11 17.01.18] ~/Workspace/react-getting-started
› npm start

> [email protected] start /Users/Username/Workspace/react-getting-started
> react-native-scripts start

14:48:19: Unable to start server
See https://git.io/v5vcn for more information, either install watchman or run the following snippet:
  sudo sysctl -w kern.maxfiles=5242880
  sudo sysctl -w kern.maxfilesperproc=524288


npm ERR! Darwin 17.3.0
npm ERR! argv "/usr/local/Cellar/node/9.4.0/bin/node" "/usr/local/bin/npm" "start"
npm ERR! node v8.9.4
npm ERR! npm  v4.2.0
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `react-native-scripts start`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] start script 'react-native-scripts start'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the react-getting-started package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     react-native-scripts start
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs react-getting-started
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls react-getting-started
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/Username/.npm/_logs/2018-01-17T13_48_19_894Z-debug.log

› tail -n 1000 /Users/Username/.npm/_logs/2018-01-17T13_48_19_894Z-debug.log

[15:17:51 17.01.18] ~/Workspace/react-getting-started
› tail -n 1000 /Users/Username/.npm/_logs/2018-01-17T13_48_19_894Z-debug.log
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/Cellar/node/9.4.0/bin/node',
1 verbose cli   '/usr/local/bin/npm',
1 verbose cli   'start' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle [email protected]~prestart: [email protected]
6 silly lifecycle [email protected]~prestart: no script for prestart, continuing
7 info lifecycle [email protected]~start: [email protected]
8 verbose lifecycle [email protected]~start: unsafe-perm in lifecycle true
9 verbose lifecycle [email protected]~start: PATH: /usr/local/lib/node_modules/npm/bin/node-gyp-bin:/Users/Username/Workspace/react-getting-started/node_modules/.bin:/Users/Username/.rvm/gems/ruby-2.3.1/bin:/Users/Username/.rvm/gems/ruby-2.3.1@global/bin:/Users/Username/.rvm/rubies/ruby-2.3.1/bin:/usr/local/Cellar/python/2.7.1/bin:/usr/local/share/npm/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/Applications/Wireshark.app/Contents/MacOS:/usr/bin/java/bin:/Users/Username/.rvm/bin
10 verbose lifecycle [email protected]~start: CWD: /Users/Username/Workspace/react-getting-started
11 silly lifecycle [email protected]~start: Args: [ '-c', 'react-native-scripts start' ]
12 silly lifecycle [email protected]~start: Returned: code: 1  signal: null
13 info lifecycle [email protected]~start: Failed to exec start script
14 verbose stack Error: [email protected] start: `react-native-scripts start`
14 verbose stack Exit status 1
14 verbose stack     at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:279:16)
14 verbose stack     at emitTwo (events.js:126:13)
14 verbose stack     at EventEmitter.emit (events.js:214:7)
14 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/spawn.js:40:14)
14 verbose stack     at emitTwo (events.js:126:13)
14 verbose stack     at ChildProcess.emit (events.js:214:7)
14 verbose stack     at maybeClose (internal/child_process.js:925:16)
14 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
15 verbose pkgid [email protected]
16 verbose cwd /Users/Username/Workspace/react-getting-started
17 error Darwin 17.3.0
18 error argv "/usr/local/Cellar/node/9.4.0/bin/node" "/usr/local/bin/npm" "start"
19 error node v8.9.4
20 error npm  v4.2.0
21 error code ELIFECYCLE
22 error errno 1
23 error [email protected] start: `react-native-scripts start`
23 error Exit status 1
24 error Failed at the [email protected] start script 'react-native-scripts start'.
24 error Make sure you have the latest version of node.js and npm installed.
24 error If you do, this is most likely a problem with the react-getting-started package,
24 error not with npm itself.
24 error Tell the author that this fails on your system:
24 error     react-native-scripts start
24 error You can get information on how to open an issue for this project with:
24 error     npm bugs react-getting-started
24 error Or if that isn't available, you can get their info via:
24 error     npm owner ls react-getting-started
24 error There is likely additional logging output above.
25 verbose exit [ 1, true ]

Environment

Please run these commands in the project folder and fill in their results:

npm ls react-native-scripts: [email protected]
npm ls react-native: [email protected]
npm ls expo: [email protected]
node -v: v8.9.4 (latest active LTS version, Carbon)
npm -v: 4.2.0 (latest version before version 5 which create-react-native-app doesn't support yet)
yarn --version: not installed
watchman version: not installed

Also specify:

Operating system: macOS High Sierra 10.13.2
Phone/emulator/simulator & version: not relevant

Fixed it.

watchman installation is required:

https://facebook.github.io/watchman/docs/install.html

Thanks to @austinhale suggesting it in this related issue:
https://github.com/react-community/create-react-native-app/issues/515

In both cases the error message says:

Unable to start server
  See https://git.io/v5vcn for more information, either install watchman or run the following snippet:
    sudo sysctl -w fs.inotify.max_user_instances=1024
    sudo sysctl -w fs.inotify.max_user_watches=12288

It sounds like installing Watchman fixed this issue so I'm going to close this. You could also increase the file watcher limits as specified.

Just type following commands to fix it if you don't wanna install Watchman

sudo sysctl -w fs.inotify.max_user_instances=1024
sudo sysctl -w fs.inotify.max_user_watches=12288

error in npm start

connection not open on send()
connection not open on send()
connection not open on send()
Error: connection not open
at WebsocketProvider.send (/home/lijo/philippines/chakka/node_modules/web3-providers-ws/src/index.js:247:18)
at Timeout._onTimeout (/home/lijo/philippines/chakka/node_modules/web3-providers-ws/src/index.js:232:19)
at ontimeout (timers.js:498:11)
at tryOnTimeout (timers.js:323:5)
at Timer.listOnTimeout (timers.js:290:5)

Since last week, (ReactJS) "npm start" started to fail with above error report. Before the error occurred, I accepted Ubuntu (16.0.4) updates, and ran "npm audit fix" as it indicated to run this command. So I don't know what caused this error.

The two commands just provisionally fix issue. The error comes back after rebooting.
sudo sysctl -w fs.inotify.max_user_instances=1024
sudo sysctl -w fs.inotify.max_user_watches=12288

I installed watchman with below steps, but doesn't help.
$ git clone https://github.com/facebook/watchman.git
$ cd watchman
$ git checkout v4.9.0 # the latest stable release
$ ./autogen.sh
$ ./configure
$ make
$ sudo make install

Seems adding these two settings to "/etc/sysctl.conf" file fixes my issue:
fs.inotify.max_user_instances=1024
fs.inotify.max_user_watches=12288

But why watchman doesn't work? Anything wrong with watchman installation?

For quick fix you can try updating you npm version.
run
npm i npm@latest -g
npm install //install node module // you can also delete previously installed node module
than
npm start
If you got luck this should work.

Just delete node_modules and re-install your dependencies
npm install

Getting similar error. Created a new reactive native app using create-react-native-app ran the app and saw the QR code. Then I ran npm audit fix and got the following error:

npm start

[email protected] start C:\Dev\Test\react-native\new-app
react-native-scripts start

16:30:38: Starting packager...
ERROR STARTING PACKAGER
No issue with doctor-watchman-version
No issue with doctor-problem-checking-watchman-version
No issue with doctor-both-app-and-exp-json
No issue with doctor-schema-validation
No issue with doctor-validate-asset-fields
No issue with doctor-schema-validation-exception
No issue with doctor-unversioned
No issue with doctor-versions-endpoint-failed
No issue with doctor-invalid-sdk-version
No issue with doctor-node-modules-missing
No issue with doctor-react-native-not-installed

C:\Dev\Test\react-native\new-app\node_modules\react-native\local-cli\cliEntry.js:30
import type {CommandT} from './commands';
^^^^^^

SyntaxError: Unexpected token import
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:616:28)
at Module._compile (C:\Dev\Test\react-native\new-app\node_modulespirates\lib\index.js:91:24)
at Module._extensions..js (module.js:663:10)
at Object.newLoader [as .js] (C:\Dev\Test\react-native\new-app\node_modulespirates\lib\index.js:96:7)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Module.require (module.js:596:17)
16:30:42: Error starting packager: Error: Metro Bundler process exited with code 1
at ChildProcess. (C:[email protected]\src\Project.js:1215:14)
at Generator.next ()
at step (C:\Dev\Test\react-native\new-app\node_modulesxdl\build\Project.js:1768:191)
at C:\Dev\Test\react-native\new-app\node_modulesxdl\build\Project.js:1768:437
at new Promise ()
at ChildProcess. (C:\Dev\Test\react-native\new-app\node_modulesxdl\build\Project.js:1768:99)
at ChildProcess.packagerProcess.once (C:[email protected]\src\Project.js:1213:5)
at Object.onceWrapper (events.js:317:30)
at emitTwo (events.js:126:13)
at ChildProcess.emit (events.js:214:7)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: react-native-scripts start
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] 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! C:\Users\myuser\AppData\Roaming\npm-cache_logs\2018-07-10T15_30_42_530Z-debug.log

Log file has the following:

0 info it worked if it ends with ok
1 verbose cli [ 'C:\Program Files\nodejs\node.exe',
1 verbose cli 'C:\Users\myuser\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js',
1 verbose cli 'start' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle [email protected]~prestart: [email protected]
6 info lifecycle [email protected]~start: [email protected]
7 verbose lifecycle [email protected]~start: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]~start: PATH: C:\Users\myuser\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Dev\Test\react-native\new-app\node_modules.bin;C:\Program FilesConEmuConEmu\Scripts;C:\Program FilesConEmu;C:\Program FilesConEmuConEmu;C:\Program Files\Docker\Docker\Resources\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL ServerClient SDK\ODBC\130\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\130\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\130\Tools\Binn\ManagementStudio\;C:\Program Files\dotnet\;C:\Program Files (x86)\Java\jdk1.8.0_112\bin;C:\Program Files (x86)\Bitvise SSH Client;C:\Program Files (x86)\Xoreax\IncrediBuild;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\Amazon\AWSCLI\;C:\Program Files\nodejs\;C:\Program Files\7-Zip;C:\Program Files\Git\cmd;C:\Program Files (x86)\Yarn\bin\;C:\Users\myuser\AppData\Local\Microsoft\WindowsApps;C:\Program Files\Microsoft VS Code\bin;C:\Program Files\Docker Toolbox;C:\Users\myuser\AppData\Local\GitHubDesktop\bin;C:\Users\myuser\AppData\Local\Microsoft\WindowsApps;C:\Users\myuser\AppData\Roaming\npm;C:\Users\myuser.dotnet\tools;C:\Users\myuser\AppData\Local\Yarn\bin
9 verbose lifecycle [email protected]~start: CWD: C:\Dev\Test\react-native\new-app
10 silly lifecycle [email protected]~start: Args: [ '/d /s /c', 'react-native-scripts start' ]
11 silly lifecycle [email protected]~start: Returned: code: 1 signal: null
12 info lifecycle [email protected]~start: Failed to exec start script
13 verbose stack Error: [email protected] start: react-native-scripts start
13 verbose stack Exit status 1
13 verbose stack at EventEmitter. (C:\Users\myuser\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\index.js:304:16)
13 verbose stack at emitTwo (events.js:126:13)
13 verbose stack at EventEmitter.emit (events.js:214:7)
13 verbose stack at ChildProcess. (C:\Users\myuser\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack at emitTwo (events.js:126:13)
13 verbose stack at ChildProcess.emit (events.js:214:7)
13 verbose stack at maybeClose (internal/child_process.js:925:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
14 verbose pkgid [email protected]
15 verbose cwd C:\Dev\Test\react-native\new-app
16 verbose Windows_NT 10.0.17134
17 verbose argv "C:\Program Files\nodejs\node.exe" "C:\Users\myuser\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js" "start"
18 verbose node v8.11.1
19 verbose npm v6.1.0
20 error code ELIFECYCLE
21 error errno 1
22 error [email protected] start: react-native-scripts start
22 error Exit status 1
23 error Failed at the [email protected] start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

I zipped the 2 folders of before and after npm audit fix but I can't upload here as it's 188 MB

Running following worked for me on mac:
sudo sysctl -w kern.maxfiles=5242880
sudo sysctl -w kern.maxfilesperproc=524288

this solves in ubuntu 17.10
sudo sysctl -w fs.inotify.max_user_instances=1024
sudo sysctl -w fs.inotify.max_user_watches=12288
After then switch to yarn from npm use
delete node_modules folder
delete yarn.lock file
yarn install
yarn start --reset-cache

npm start
did not work, but worked with
expo start

Was this page helpful?
0 / 5 - 0 ratings