Skip to content
This repository has been archived by the owner on Jan 18, 2024. It is now read-only.

Running multiple expo start processes in the same folder causes packager configuration to be overwritten #4091

Closed
JacobJaffe opened this issue Dec 22, 2021 · 6 comments
Labels
enhancement New feature or request wontfix This will not be worked on

Comments

@JacobJaffe
Copy link

Summary

I'm using expo start -p to run two expo apps at the same time. It looks like that port isn't being used when quick-opening (e.g., press i | open iOS simulator ).

For example, here's the output from initial expo start -p 19001 + i:

› Metro waiting on exp://10.0.0.10:19001 <-- CORRECT port
› Scan the QR code above with Expo Go (Android) or the Camera app (iOS)

› Press a │ open Android
› Press i │ open iOS simulator
› Press w │ open web

› Press r │ reload app
› Press m │ toggle menu
› Press d │ show developer tools
› shift+d │ toggle auto opening developer tools on startup (enabled)

› Press ? │ show all commands

Logs for your project will appear below. Press Ctrl+C to exit.
› Opening on iOS...
› Opening exp://127.0.0.1:19000 on iPhone 13 <-- NOT the right port 
› Press ? │ show all commands

Environment

  Expo CLI 5.0.1 environment info:
    System:
      OS: macOS 11.4
      Shell: 5.8 - /bin/zsh
    Binaries:
      Node: 12.16.1 - /var/folders/fp/3wdkcqp13kb69tq6gt56pkpm0000gn/T/yarn--1640195674059-0.051110735414527264/node
      Yarn: 1.22.17 - /var/folders/fp/3wdkcqp13kb69tq6gt56pkpm0000gn/T/yarn--1640195674059-0.051110735414527264/yarn
      npm: 6.14.9 - ~/.nvm/versions/node/v12.16.1/bin/npm
    SDKs:
      iOS SDK:
        Platforms: DriverKit 21.2, iOS 15.2, macOS 12.1, tvOS 15.2, watchOS 8.3
    IDEs:
      Android Studio: 3.3 AI-182.5107.16.33.5264788
      Xcode: 13.2.1/13C100 - /usr/bin/xcodebuild
    npmPackages:
      expo: ~43.0.0 => 43.0.1
      react: 17.0.1 => 17.0.1
      react-dom: 17.0.1 => 17.0.1
      react-native: 0.64.3 => 0.64.3
      react-native-web: 0.17.1 => 0.17.1
    npmGlobalPackages:
      expo-cli: 4.12.10
    Expo Workflow: managed

Please specify your device/emulator/simulator platform, model and version

iOS 15.2 iPhone 13

Error output

No response

Reproducible demo or steps to reproduce from a blank project

In one window ("Window-A"), run

expo start -p 19000

In another ("Window-B"), run

expo start -p 19001

from Window-A, press i.

The metro bundler will log that the app is opening on 19000, rather than 19001.

@JacobJaffe JacobJaffe added the bug Something isn't working label Dec 22, 2021
@JacobJaffe
Copy link
Author

JacobJaffe commented Dec 22, 2021

FWIW, this is straightforward to work around by manually entering the project URL

Explicit URL in Expo app

Simulator Screen Shot - iPhone 13 - 2021-12-22 at 10 07 27

@kbrandwijk
Copy link
Contributor

kbrandwijk commented Jan 5, 2022

Are these two projects running in two completely separate folders?

When I run a single project, on a different port number, then hit i, it uses the supplied port number. The only thing I can think of is that in a monorepo, there might be a single .expo/settings.json in the projectRoot, and the last started project wins putting the port number in there.

@JacobJaffe
Copy link
Author

These projects are a single folder -- I'm using an app.config.ts configuration to build two slightly different apps (for two different released apps in the stores). It does look like .expo/packager-info.json is getting overwritten

@kbrandwijk
Copy link
Contributor

Yeah, that confirms my suspicion: that single file is used to read the packager config, so starting two in the same folder will unfortunately overwrite the config that the open simulator function looks at.

I can't think of an easy fix tbh.

@kbrandwijk kbrandwijk added enhancement New feature or request and removed bug Something isn't working labels Jan 5, 2022
@kbrandwijk kbrandwijk changed the title expo start -p port selection not applied to quick open options Running multiple expo start processes in the same folder causes packager configuration to be overwritten Jan 5, 2022
@EvanBacon EvanBacon added the wontfix This will not be worked on label Jan 22, 2022
@EvanBacon
Copy link
Contributor

We only support running one instance of expo start per project, at a time. This is a hard limitation that we don't plan on changing as it could cause unexpected behavior in many different parts of the project. For example, if both processes are attempting to modify the same file at the same time, you'll hit a race condition which is hard to test against and diagnose.

@JacobJaffe
Copy link
Author

😞

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

3 participants