react-native: Missing Semicolon in node-modules/react-native/index.js at line 313

Description

Description I’m encountering a Missing Semicolon syntax error in the index.js file of React Native when building the project. The error occurs specifically at line 313 where the following code is present:

} as ReactNativePublicAPI;

It appears that the semicolon is missing after this line, causing the build to fail.

Steps to reproduce

  1. Install React Native project.
  2. Attempt to build the project ‘react-native run-ios’
  3. The error Missing Semicolon occurs in the index.js file at line 313.

React Native Version

^0.79.0

Affected Platforms

Runtime - iOS

Output of npx @react-native-community/cli info

System:
  OS: macOS 15.3.2
  CPU: (8) arm64 Apple M2
  Memory: 111.97 MB / 16.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 20.11.1
    path: ~/.nvm/versions/node/v20.11.1/bin/node
  Yarn:
    version: 1.22.22
    path: ~/.nvm/versions/node/v20.11.1/bin/yarn
  npm:
    version: 10.2.4
    path: ~/.nvm/versions/node/v20.11.1/bin/npm
  Watchman:
    version: 2025.03.10.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.16.2
    path: /opt/homebrew/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 24.4
      - iOS 18.4
      - macOS 15.4
      - tvOS 18.4
      - visionOS 2.4
      - watchOS 11.4
  Android SDK: Not Found
IDEs:
  Android Studio: 2024.3 AI-243.24978.46.2431.13208083
  Xcode:
    version: 16.3/16E140
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: javac 22
    path: /usr/bin/javac
  Ruby:
    version: 3.2.2
    path: /Users/chooseongwoo/.rbenv/shims/ruby
npmPackages:
  "@react-native-community/cli":
    installed: 18.0.0
    wanted: 18.0.0
  react:
    installed: 19.0.0
    wanted: 19.0.0
  react-native:
    installed: 0.79.0
    wanted: 0.79.0
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: true
  newArchEnabled: true

Stacktrace or Logs

SyntaxError: /Users/chooseongwoo/Coding/Project/SPOTT/node_modules/react-native/index.js: Missing semicolon. (313:1)

  311 |   },
  312 |   // #endregion
> 313 | } as ReactNativePublicAPI;
      |  ^
  314 |
  315 | if (__DEV__) {
  316 |   /* $FlowFixMe[prop-missing] This is intentional: Flow will error when

Reproducer

https://github.com/chooseongwoo/spot

Screenshots and Videos

Image

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 5
  • Comments: 35 (5 by maintainers)

Commits related to this issue

Most upvoted comments

Thanks for the tips pointing to babel! I had to update my babel.config.js presets path to use @react-native/babel-preset instead of module:metro-react-native-babel-preset

Have the exact same issue

Thanks for the tips pointing to babel! I had to update my babel.config.js presets path to use @react-native/babel-preset instead of module:metro-react-native-babel-preset

This is working fine

+1

Thanks for the tips pointing to babel! I had to update my babel.config.js presets path to use @react-native/babel-preset instead of module:metro-react-native-babel-preset

This worked for me. Currently on React native 0.79.3

I was able to pass this error, once I’ve updated my @react-native/metro-config to latest version (0.79.1)

@huextrat Right, so in your case you’re depending on react-native-builder-bob, and not our Babel preset.

  • Looks like this is definitely broken(!) [1] ( @babel/preset-flow is unsupported). I’ll attempt a PR. This probably isn’t what’s affecting other users here though.