From 95972cfd08dd95e1df13c8a15aba8b5655b83a8e Mon Sep 17 00:00:00 2001 From: Adrov Igor Date: Thu, 29 Oct 2015 08:51:17 -0700 Subject: [PATCH] fix error handling in packager Summary: Currently on error I have following output: ``` ERROR Packager can't listen on port 8081 Most likely another process is already using this port Run the following command to find out which process: lsof -n -i4TCP:8081 You can either shut down the other process: kill -9 or run packager on different port. See http://facebook.github.io/react-native/docs/troubleshooting.html for common problems and solutions. /Users/nucleartux/Work/projects/react-native/local-cli/server/server.js:90 if (error.code === 'EADDRINUSE') { ^ TypeError: Cannot read property 'code' of undefined at process. (/Users/nucleartux/Work/projects/react-native/local-cli/server/server.js:104:14) at emitOne (events.js:77:13) at process.emit (events.js:169:7) at process._fatalException (node.js:211:26) ``` Closes https://github.com/facebook/react-native/pull/3765 Reviewed By: svcscm Differential Revision: D2595537 Pulled By: martinbigio fb-gh-sync-id: e11ec2e6e8794bf5fe7570e27cd327777d8b300c --- local-cli/server/server.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/local-cli/server/server.js b/local-cli/server/server.js index 266bc5bd4..d54328973 100644 --- a/local-cli/server/server.js +++ b/local-cli/server/server.js @@ -122,7 +122,7 @@ function _server(argv, config, resolve, reject) { } console.log('\nSee', chalk.underline('http://facebook.github.io/react-native/docs/troubleshooting.html')); console.log('for common problems and solutions.'); - reject(); + process.exit(1); }); // TODO: remove once we deprecate this arg