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:
- Make sure you are not running anything on port 8081
- 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:
- Start metro bundler
npm start 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:
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 25 (20 by maintainers)
Commits related to this issue
- #4819 rewrite the check port script with built-in isPackagerRunning function and rename the script — committed to dklymenk/Expensify.cash by dklymenk 3 years ago
- #4819 add comment with isPackagerRunning function description — committed to dklymenk/Expensify.cash by dklymenk 3 years ago
- Merge pull request #5096 from dklymenk/4819-improve-check-port-script #4819 improve the check port script — committed to Expensify/App by marcaaron 3 years ago
I certainly forgot to add this to the code examples above, but I would require it just like anything else in node.
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.
Posted in Upwork!
Internal post - https://www.upwork.com/ab/applicants/1431066549132935168/job-details External post - https://www.upwork.com/jobs/~01a8053e60a1e89c37
Hired @dklymenk!
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.
checkMetroPortone! Maybe we could replace the word metro withBundlerorPackager? I don’t know.Let’s see what the others think.