packager-info.json lives in the .expo directory inside your project. Unfortunately it seems this is written when you run expo start, so it doesn’t seem possible to specify the port.
There are a couple of things you could do to work around this. e.g. fork expo-cli and change the devToolsPort. If you find a good way to do it you might even want to contribute the change back to Expo.
I think something like this might work:
diff --git packages/dev-tools/server/DevToolsServer.js packages/dev-tools/server/DevToolsServer.js
index e0d49a3b..4da83a9a 100644
--- packages/dev-tools/server/DevToolsServer.js
+++ packages/dev-tools/server/DevToolsServer.js
@@ -48,8 +48,8 @@ export async function createAuthenticationContextAsync({ port }) {
};
}
-export async function startAsync(projectDir) {
- const port = await freeportAsync(19002, { hostnames: [null, 'localhost'] });
+export async function startAsync(projectDir, desiredPort) {
+ const port = await freeportAsync(desiredPort, { hostnames: [null, 'localhost'] });
const server = express();
const authenticationContext = await createAuthenticationContextAsync({ port });
diff --git packages/expo-cli/src/commands/start.js packages/expo-cli/src/commands/start.js
index 4d4a2993..5727e6c8 100644
--- packages/expo-cli/src/commands/start.js
+++ packages/expo-cli/src/commands/start.js
@@ -248,6 +248,8 @@ export default (program: any) => {
.option('--max-workers [num]', 'Maximum number of tasks to allow Metro to spawn.')
.option('--dev', 'Turn development mode on')
.option('--no-dev', 'Turn development mode off')
+ .option('--dev-tools-port <port>', 'Specify the preferred port for the dev tools server',
+ (value, dummyPrevious) => parseInt(value), 19002)
.option('--minify', 'Minify code')
.option('--no-minify', 'Do not minify code')
.option('--https', 'To start webpack with https protocol')
Otherwise you could set up something crude like inetd and netcat that just forwards connections from port 8080 to port 19002. Or something more sophisticated like a proper HTTP proxy server (e.g. nginx, Apache, HAProxy, Squid).