App: [HOLD for payment 2021-09-17] [DEV] The check port script fails on it's own and does not check if the process running on the port is a metro bundler

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


1. Script Fails on it’s own

Action Performed:

  1. Make sure you are not running anything on port 8081
  2. Try to run npm run android

Expected Result:

The check port script passes and continues execution

Actual Result:

The script reports that port 8081 is used. Possibly because it tries to start 3 servers on the same port at the same time.

Workaround:

Run npx react-native run-android manually to avoid running the check port script

Platform:

Where is this issue occurring?

  • GNU/Linux (Arch Linux)

2. Script does not check if port is used by bundler

Action Performed:

  1. Start metro bundler npm start
  2. npm run android

Expected Result:

The check port scripts doesn’t error out if port 8081 is already used by metro bundler

Actual Result:

The script reports that port 8081 is used and prevents further execution

Workaround:

Run npx react-native run-android manually to avoid running the check port script

Platform:

Where is this issue occurring?

  • GNU/Linux (Arch Linux)
  • macOS Big Sur

Version Number: Logs: https://stackoverflow.com/c/expensify/questions/4856 Notes/Photos/Videos: Any additional supporting documentation Expensify/Expensify Issue URL:

View all open jobs on GitHub

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 25 (20 by maintainers)

Commits related to this issue

Most upvoted comments

The one question I have is how are you going to access that isPackagerRunning method. Are you going to make a copy from the source, or are you going to install the source via npm and import it?

I certainly forgot to add this to the code examples above, but I would require it just like anything else in node.

const {isPackagerRunning} = require('@react-native-community/cli-tools');

We don’t have to install anything, we already have all the needed node modules in the project. In fact, commands npm run {android,ios} use this exact function under the hood to check whether a metro bundler should be started.

7 days since PR deployed - paid @dklymenk in Upwork (including $250 bonus for finding and fixing the bug) and closed the job.

I agree with Horus that the port doesn’t need to be flexible at this point (we can always adjust it later if we need to). I’d be OK with a name change as well, and I do not have a strong opinion about what it changes to. I think all suggestions have been fine.

cc @Christinadobrzyn I am giving the official 🟢 to hire @dklymenk for this job.

  1. I would assume that the port it’s always 8081.
  2. I like the checkMetroPort one! Maybe we could replace the word metro with Bundler or Packager? I don’t know.

Let’s see what the others think.