Skip to content

react native connect installed with @react-native-community/cli causing issues #2625

Open
@sanaf1333

Description

@sanaf1333

Environment

npx react-native info output

System:
  OS: macOS 15.0.1
  CPU: (12) arm64 Apple M2 Pro
  Memory: 147.67 MB / 16.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 22.1.0
    path: ~/.nvm/versions/node/v22.1.0/bin/node
  Yarn:
    version: 1.22.22
    path: ~/.nvm/versions/node/v22.1.0/bin/yarn
  npm:
    version: 10.8.2
    path: ~/.nvm/versions/node/v22.1.0/bin/npm
  Watchman:
    version: 2025.02.17.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.16.2
    path: /opt/homebrew/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 24.0
      - iOS 18.0
      - macOS 15.0
      - tvOS 18.0
      - visionOS 2.0
      - watchOS 11.0
  Android SDK:
    API Levels:
      - "31"
      - "34"
      - "35"
    Build Tools:
      - 33.0.1
      - 34.0.0
      - 35.0.0
    System Images:
      - android-35 | Google Play ARM 64 v8a
      - android-35 | Pre-Release 16 KB Page Size Google APIs ARM 64 v8a
    Android NDK: Not Found
IDEs:
  Android Studio: 2024.1 AI-241.15989.150.2411.11948838
  Xcode:
    version: 16.0/16A242d
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.11
    path: /Library/Java/JavaVirtualMachines/jdk-17.jdk/Contents/Home/bin/javac
  Ruby:
    version: 2.6.10
    path: /usr/bin/ruby
npmPackages:
  "@react-native-community/cli":
    installed: 17.0.0
    wanted: ^17.0.0
  react:
    installed: 18.3.1
    wanted: 18.3.1
  react-native:
    installed: 0.76.6
    wanted: 0.76.6
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: true
  newArchEnabled: true

npx react-native doctor is passing.

Description

I am converting my react native expo project to bare workflow. i ran npx expo prebuild to eject the project successfully. I installed

"@react-native-community/cli": "^17.0.0",
"@tsconfig/react-native": "^3.0.5",
"metro": "^0.82.0",
   "metro-config": "^0.82.0",
   "metro-core": "^0.82.0",
   "metro-react-native-babel-transformer": "^0.77.0",

when I run 'npx react-native start --reset-cache` it throws me this error

error Cannot read properties of undefined (reading 'handle').
TypeError: Cannot read properties of undefined (reading 'handle')
    at Function.use (/Users/sanafatima/Desktop/Twin_App/investor-mobile-app/node_modules/connect/index.js:87:21)
    at exports.runServer (/Users/sanafatima/Desktop/Twin_App/investor-mobile-app/node_modules/@react-native/community-cli-plugin/node_modules/metro/src/index.flow.js:146:15)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Object.runServer [as func] (/Users/sanafatima/Desktop/Twin_App/investor-mobile-app/node_modules/@react-native/community-cli-plugin/dist/commands/start/runServer.js:136:26)
    at async Command.handleAction (/Users/sanafatima/Desktop/Twin_App/investor-mobile-app/node_modules/@react-native-community/cli/build/index.js:139:9)
info Run CLI with --verbose flag for more details.

Apparently its coming from a module connect being installed as a dependency. I have tried to uninstall and install everything multiple times with different versions but unable to resolve the issue. I'd be grateful if someone can help me resolve the issue. Here is the output for npm ls connect


├─┬ @react-native-community/[email protected]
│ └─┬ @react-native-community/[email protected]
│   └── [email protected] deduped
├─┬ @react-native/[email protected]
│ └─┬ [email protected]
│   ├── [email protected] deduped
│   └─┬ [email protected]
│     └── [email protected] deduped
├─┬ [email protected]
│ └─┬ @expo/[email protected]
│   ├─┬ @react-native/[email protected]
│   │ └── [email protected] deduped
│   └── [email protected] deduped
├─┬ [email protected]
│ └── [email protected]
├─┬ [email protected]
│ └── [email protected] deduped
└─┬ [email protected]
  └─┬ @react-native/[email protected]
    ├─┬ @react-native/[email protected]
    │ └── [email protected] deduped
    ├─┬ [email protected]
    │ └── [email protected] deduped
    └─┬ [email protected]
      └── [email protected] deduped

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions