2

I installed react-native as per the instructions but on

$npm start 

I the following error.

ERROR  Metro Bundler can't listen on port 8081
Loading dependency graph...
npm ERR! Darwin 17.3.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"
npm ERR! node v7.8.0
npm ERR! npm  v4.2.0
npm ERR! code ELIFECYCLE
npm ERR! errno 11
npm ERR! TDemo@0.0.1 start: `node node_modules/react-native/local-
cli/cli.js start`

I guess there is some sort of dependency or conflict, does anyone know how I can figure out what it is?

Kittovski
  • 177
  • 3
  • 16
  • 1
    [relevant?](https://stackoverflow.com/questions/41315475/react-native-error-packager-cant-listen-on-port-8081) try editing port? `--port=8088`. [Even more relevant?](https://stackoverflow.com/questions/43425754/react-native-error-packager-cant-listen-on-port-8081) – Vanity Slug - codidact.com Dec 01 '17 at 16:38
  • Ah yes, that did it. Thanks so much – Kittovski Dec 01 '17 at 17:35

2 Answers2

8

Run the following command to find id of the process which is using port 8081
sudo lsof -i :8081
Then run the following to terminate process:
kill -9 23583

Here is how it will look like enter image description here

RC_02
  • 3,146
  • 1
  • 18
  • 20
2

i guess port 8081 is used somewhere try to kill port and run again

Find (and kill) process locking port 3000 on Mac

Jigar
  • 1,314
  • 9
  • 19