From 921921237f17252506d4a577d9d72f738e77e3d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joel=20S=C3=A1nchez?= Date: Wed, 30 Nov 2016 17:01:00 -0800 Subject: [PATCH] Add alternative lsof command for killing a process running on port 8081. Summary: I was running RN 0.31 on ArchLinux (kernel 4.7), and "react-native start" was refusing to run on the default (and sometimes required, as I have noticed) port. I tried executing the suggested lsof command, but that did not work. Somewhere I found the lsof command I include in this commit, and that worked (it was a node.js process). So I'm including it, since I found it helpful. Closes https://github.com/facebook/react-native/pull/9402 Reviewed By: lacker Differential Revision: D4144400 Pulled By: hramos fbshipit-source-id: 6203549455555efc59b7bab0a3ec23957d80b956 --- docs/Troubleshooting.md | 2 +- local-cli/server/server.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/Troubleshooting.md b/docs/Troubleshooting.md index 37428ecbb..001ddbb6e 100644 --- a/docs/Troubleshooting.md +++ b/docs/Troubleshooting.md @@ -16,7 +16,7 @@ The React Native packager runs on port 8081. If another process is already using Run the following command on a Mac to find the id for the process that is listening on port 8081: -`$ sudo lsof -n -i4TCP:8081 | grep LISTEN` +`$ sudo lsof -i :8081` Then run the following to terminate the process: diff --git a/local-cli/server/server.js b/local-cli/server/server.js index b7f3a64ab..35142e7b3 100644 --- a/local-cli/server/server.js +++ b/local-cli/server/server.js @@ -50,8 +50,8 @@ function server(argv, config, args) { ); console.log('Most likely another process is already using this port'); console.log('Run the following command to find out which process:'); - console.log('\n ', chalk.bold('lsof -n -i4TCP:' + args.port), '\n'); - console.log('You can either shut down the other process:'); + console.log('\n ', chalk.bold('lsof -i :' + args.port), '\n'); + console.log('Then, you can either shut down the other process:'); console.log('\n ', chalk.bold('kill -9 '), '\n'); console.log('or run packager on different port.'); } else {