Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
chooseongwoo opened this issue Apr 13, 2025 · 25 comments
Closed

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

chooseongwoo opened this issue Apr 13, 2025 · 25 comments
Labels
Needs: Author Feedback Needs: Repro This issue could be improved with a clear list of steps to reproduce the issue. Resolution: Answered When the issue is resolved with a simple answer

Comments

@chooseongwoo
Copy link

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

@TheDude70
Copy link

Have the exact same issue

@frg100
Copy link

frg100 commented Apr 14, 2025

+1

3 similar comments
@mfaisal075
Copy link

+1

@phucnguyen021295
Copy link

+1

@MuhammadRafeh
Copy link

+1

@SasquatchLV
Copy link

+1, need a fix asap !

@mfaisal075
Copy link

I was also facing the same problem, I was using the new version, then I created a new app on the old version, for example I used version 0.76.3, now the app is running fine. You can also use this method. Hopefully your problem gets resolved.

@SasquatchLV
Copy link

I was also facing the same problem, I was using the new version, then I created a new app on the old version, for example I used version 0.76.3, now the app is running fine. You can also use this method. Hopefully your problem gets resolved.

0.76.x is already unsupported version - https://github.com/reactwg/react-native-releases/blob/main/docs/support.md

We need react 19.x which is for RN 0.79

@MuhammadRafeh
Copy link

@SasquatchLV For workaround we can use 0.78.0 version which is stable.

@mfaisal075
Copy link

mfaisal075 commented Apr 14, 2025

I was also facing the same problem, I was using the new version, then I created a new app on the old version, for example I used version 0.76.3, now the app is running fine. You can also use this method. Hopefully your problem gets resolved.

0.76.x is already unsupported version - https://github.com/reactwg/react-native-releases/blob/main/docs/support.md

We need react 19.x which is for RN 0.79

You can try 0.77.x or 0.78.x for now, because I was facing the same issue but didn't get a solution.

@nptech0983
Copy link

+1

3 similar comments
@philip-bui-goldenowl
Copy link

+1

@denisrybalka
Copy link

+1

@winwinProject
Copy link

+1

@cortinico
Copy link
Contributor

Hey all,
Nicola from the React Native team here,

I've tried to reproduce this issue on RN 0.79 with either Node 18, 20 or 22 and I cannot reproduce.

The suspect is that you folks are having some custom babel setup. Without a proper reproducer we can't isolate the issue and help you further sadly.

@cortinico cortinico added the Needs: Repro This issue could be improved with a clear list of steps to reproduce the issue. label Apr 15, 2025
@react-native-bot
Copy link
Collaborator

Warning

Missing reproducer: We could not detect a reproducible example in your issue report. Please provide either:

@cortinico
Copy link
Contributor

@chooseongwoo your repro is empty also

@huntie
Copy link
Member

huntie commented Apr 15, 2025

Dittoing what @cortinico says, we need a repro project, with a committed yarn.lock, that replicates this error.

I'm suspecting this may also be related to either:

  • An outdated install of @react-native/babel-preset. Please note that all @react-native/ dependencies MUST match the major version of react-native, in this case, exactly 0.79.1.
  • A custom Babel setup with 3P plugins.

@huextrat
Copy link

@cortinico @huntie Hi, I have the same issue on my library: huextrat/react-native-rate-app#201

But for the moment I haven't looked into it in detail, I'm just sharing if it helps you move forward

@SasquatchLV
Copy link

Hey all, Nicola from the React Native team here,

I've tried to reproduce this issue on RN 0.79 with either Node 18, 20 or 22 and I cannot reproduce.

The suspect is that you folks are having some custom babel setup. Without a proper reproducer we can't isolate the issue and help you further sadly.

Well, i have set up custom path aliases in babel.config.js , so i assume something has changed in 0.79 since these do not work anymore.

@huntie
Copy link
Member

huntie commented Apr 15, 2025

@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.

@kaaoo
Copy link

kaaoo commented Apr 15, 2025

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

@frg100
Copy link

frg100 commented Apr 15, 2025

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

satya164 added a commit to callstack/react-native-builder-bob that referenced this issue Apr 16, 2025
### Summary

Fixes compatibility of `react-native-builder-bob/babel-preset` with
React Native versions `>= 0.76.0` — likely broken today, without user
config modifications.

- `@babel/preset-flow` is
[discontinued](babel/babel#16264). The Flow
language has since evolved (e.g. `as` syntax) and newer `react-native`
versions can no longer be parsed.
- This is succeeded by
[babel-plugin-syntax-hermes-parser](https://github.com/facebook/hermes/tree/main/tools/hermes-parser/js/babel-plugin-syntax-hermes-parser).

Context:

- facebook/react-native#50683 (comment)

Co-authored-by: Satyajit Sahoo <satyajit.happy@gmail.com>
@Sang0424
Copy link

I'm facing the same error.
Has anyone found a fix or workaround?

@cortinico
Copy link
Contributor

Closing as we verified that this was due to a wrong babel configuration. React Native Builder Bob has been updated to do not use the @babel/preset-flow plugin here:

There is nothing left to do on react-native for us.

@cortinico cortinico added the Resolution: Answered When the issue is resolved with a simple answer label Apr 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs: Author Feedback Needs: Repro This issue could be improved with a clear list of steps to reproduce the issue. Resolution: Answered When the issue is resolved with a simple answer
Projects
None yet
Development

No branches or pull requests