Skip to content

[email protected] fail to start - Cannot read property 'reportEvent' of undefined #1564

@Nodonisko

Description

@Nodonisko

Environment

System:
    OS: macOS 12.2
    CPU: (8) x64 Intel(R) Core(TM) i5-8257U CPU @ 1.40GHz
    Memory: 168.50 MB / 8.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 14.18.1 - /var/folders/j4/nw3_c4nd029_zvtg_cy0k1d80000gn/T/yarn--1645213250030-0.5190764815852629/node
    Yarn: 1.22.15 - /var/folders/j4/nw3_c4nd029_zvtg_cy0k1d80000gn/T/yarn--1645213250030-0.5190764815852629/yarn
    npm: 6.14.15 - ~/.nvm/versions/node/v14.18.1/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.11.2 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 21.2, iOS 15.2, macOS 12.1, tvOS 15.2, watchOS 8.3
    Android SDK: Not Found
  IDEs:
    Android Studio: 2020.3 AI-203.7717.56.2031.7935034
    Xcode: 13.2.1/13C100 - /usr/bin/xcodebuild
  Languages:
    Java: javac 13 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: ^7.0.2 => 7.0.2
    react: 17.0.2 => 17.0.2
    react-native: 0.68.0-rc.1 => 0.68.0-rc.1
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

Description

Hi, I tried to init new project npx react-native init RN068RC1 --version 0.68.0-rc.1 but when I run yarn start, it will throw this error:

error Cannot read property 'reportEvent' of undefined.
TypeError: Cannot read property 'reportEvent' of undefined
    at Object.runServer [as func] (/Users/danielsuchy/javascript/RN068RC1/node_modules/@react-native-community/cli-plugin-metro/build/commands/start/runServer.js:131:38)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at async Command.handleAction (/Users/danielsuchy/javascript/RN068RC1/node_modules/@react-native-community/cli/build/index.js:192:9)

I tried this on my second computer with same result.

I figured out this hotfix for package.json:

"resolutions": {
    "@react-native-community/cli-server-api": "7.0.0",
}

Reproducible Demo

npx react-native init RN068RC1 --version 0.68.0-rc.1

Then try to run packager yarn start.

// edit: replaced my hotfix by hotfix from @NickGerleman in case anyone else will encounter issue

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