microsoft/rnx-kit

Receiving error when trying to specify a port when running

cvlehe opened this issue · 1 comments

What happened?

When running react-native rnx-start --port 62536 I receive the following error:

error options.port should be >= 0 and < 65536. Received type number (NaN).
RangeError [ERR_SOCKET_BAD_PORT]: options.port should be >= 0 and < 65536. Received type number (NaN).
    at new NodeError (node:internal/errors:399:5)
    at validatePort (node:internal/validators:390:11)
    at Server.listen (node:net:1868:5)
    at /Users/cvonlehe/Projects/react-native/scheduling-admin-app/node_modules/@react-native/community-cli-plugin/node_modules/metro/src/index.flow.js:321:14
    at new Promise (<anonymous>)
    at earlyPortCheck (/Users/cvonlehe/Projects/react-native/scheduling-admin-app/node_modules/@react-native/community-cli-plugin/node_modules/metro/src/index.flow.js:317:11)
    at exports.runServer (/Users/cvonlehe/Projects/react-native/scheduling-admin-app/node_modules/@react-native/community-cli-plugin/node_modules/metro/src/index.flow.js:124:9)
    at startServer (/Users/cvonlehe/Projects/react-native/scheduling-admin-app/node_modules/@rnx-kit/metro-service/lib/server.js:64:12)
    at Object.rnxStart [as func] (/Users/cvonlehe/Projects/react-native/scheduling-admin-app/node_modules/@rnx-kit/cli/lib/start.js:140:66)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

This seems to be cause by parseInt located here: https://github.com/microsoft/rnx-kit/blob/main/packages/cli/src/start.ts#L237

Affected Package

@rnx-kit/cli

Version

0.16.22

Which platforms are you seeing this issue on?

  • Android
  • iOS
  • macOS
  • Windows

System Information

System:
  OS: macOS 14.5
  CPU: (10) arm64 Apple M2 Pro
  Memory: 224.78 MB / 32.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 18.14.2
    path: ~/.nodenv/versions/18.14.2/bin/node
  Yarn: Not Found
  npm:
    version: 9.5.0
    path: ~/.nodenv/versions/18.14.2/bin/npm
  Watchman:
    version: 2024.04.15.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.14.3
    path: /Users/cvonlehe/.rbenv/shims/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 23.4
      - iOS 17.4
      - macOS 14.4
      - tvOS 17.4
      - visionOS 1.1
      - watchOS 10.4
  Android SDK: Not Found
IDEs:
  Android Studio: 2023.1 AI-231.9392.1.2311.11330709
  Xcode:
    version: 15.3/15E204a
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 21.0.2
    path: /opt/homebrew/opt/openjdk/bin/javac
  Ruby:
    version: 3.2.1
    path: /Users/cvonlehe/.rbenv/shims/ruby
npmPackages:
  "@react-native-community/cli":
    installed: 12.3.6
    wanted: ^12.1.1
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.73.6
    wanted: 0.73.6
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: true
  newArchEnabled: false

Steps to Reproduce

Run react-native rnx-start --port [port] specifying any port that is >= 0 and < 65536.

Code of Conduct

  • I agree to follow this project's Code of Conduct

Thanks for the report!