Skip to content
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

[Fixed in @react-native/babel-preset 0.76.4] Syntax error in EventEmitter.js when using Babel #46355

Closed
mdjastrzebski opened this issue Sep 5, 2024 · 26 comments
Assignees
Labels
Flow Resolution: Fixed A PR that fixes this issue has been merged.

Comments

@mdjastrzebski
Copy link
Contributor

mdjastrzebski commented Sep 5, 2024

Description

yarn test fails on RN app from nightly template.

Error:

 FAIL  __tests__/App.test.tsx
  ● Test suite failed to run

    SyntaxError: /Users/maciej/Dev/Temp/RnNightly/node_modules/react-native/Libraries/vendor/emitter/EventEmitter.js: Unexpected token, expected "]" (39:5)

      37 |
      38 | type Registry<TEventToArgsMap: {...}> = {
    > 39 |   [K in keyof TEventToArgsMap]: Set<Registration<TEventToArgsMap[K]>>,
         |      ^
      40 | };
      41 |
      42 | /**

      18 | } from 'react-native';
      19 |
    > 20 | import {
         | ^
      21 |   Colors,
      22 |   DebugInstructions,
      23 |   Header,

This does not seem to be related to react-test-renderer deprecation but rather to Flow processing in RN repo.

Steps to reproduce

  1. Create RN app from 0.76 nightly: npx react-native init RnNightly --version nightly
  2. yarn install
  3. yarn test fails with reported error.

React Native Version

0.76.0-nightly-20240905-62ee5c9b8

Affected Platforms

Other (please specify)

Output of npx react-native info

System:
  OS: macOS 14.6.1
  CPU: (10) arm64 Apple M1 Pro
  Memory: 95.78 MB / 32.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 20.12.0
    path: ~/.nvm/versions/node/v20.12.0/bin/node
  Yarn:
    version: 3.6.4
    path: ~/.nvm/versions/node/v20.12.0/bin/yarn
  npm:
    version: 10.5.0
    path: ~/.nvm/versions/node/v20.12.0/bin/npm
  Watchman: Not Found
Managers:
  CocoaPods:
    version: 1.15.2
    path: /Users/maciej/.rbenv/shims/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 23.5
      - iOS 17.5
      - macOS 14.5
      - tvOS 17.5
      - visionOS 1.2
      - watchOS 10.5
  Android SDK:
    API Levels:
      - "28"
      - "30"
      - "31"
      - "34"
    Build Tools:
      - 30.0.3
      - 34.0.0
    System Images:
      - android-31 | Google Play ARM 64 v8a
      - android-32 | Google Play ARM 64 v8a
      - android-34 | ARM 64 v8a
      - android-34 | Google Play ARM 64 v8a
    Android NDK: Not Found
IDEs:
  Android Studio: 2024.1 AI-241.15989.150.2411.11948838
  Xcode:
    version: 15.4/15F31d
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.10
    path: /usr/bin/javac
  Ruby:
    version: 2.7.5
    path: /Users/maciej/.rbenv/shims/ruby
npmPackages:
  "@react-native-community/cli":
    installed: 14.0.0-alpha.11
    wanted: 14.0.0-alpha.11
  react:
    installed: 19.0.0-rc-fb9a90fa48-20240614
    wanted: 19.0.0-rc-fb9a90fa48-20240614
  react-native:
    installed: 0.76.0-nightly-20240905-62ee5c9b8
    wanted: nightly
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: Not found
  newArchEnabled: false

Stacktrace or Logs

SyntaxError: /Users/maciej/Development/OpenSource/Temp/RnNightly/node_modules/react-native/Libraries/vendor/emitter/EventEmitter.js: Unexpected token, expected "]" (39:5)

      37 |
      38 | type Registry<TEventToArgsMap: {...}> = {
    > 39 |   [K in keyof TEventToArgsMap]: Set<Registration<TEventToArgsMap[K]>>,
         |      ^
      40 | };
      41 |
      42 | /**

      18 | } from 'react-native';
      19 |
    > 20 | import {
         | ^
      21 |   Colors,
      22 |   DebugInstructions,
      23 |   Header,

      at constructor (node_modules/@babel/parser/src/parse-error.ts:95:45)
      at FlowParserMixin.toParseError [as raise] (node_modules/@babel/parser/src/tokenizer/index.ts:1496:19)
      at FlowParserMixin.raise [as unexpected] (node_modules/@babel/parser/src/tokenizer/index.ts:1536:16)
      at FlowParserMixin.unexpected [as expect] (node_modules/@babel/parser/src/parser/util.ts:157:12)
      at FlowParserMixin.expect [as flowParseObjectTypeIndexer] (node_modules/@babel/parser/src/plugins/flow/index.ts:1013:12)
      at FlowParserMixin.flowParseObjectTypeIndexer [as flowParseObjectType] (node_modules/@babel/parser/src/plugins/flow/index.ts:1171:20)
      at FlowParserMixin.flowParseObjectType [as flowParsePrimaryType] (node_modules/@babel/parser/src/plugins/flow/index.ts:1561:23)
      at FlowParserMixin.flowParsePrimaryType (node_modules/@babel/parser/src/plugins/flow/index.ts:1754:23)
      at FlowParserMixin.flowParsePostfixType [as flowParsePrefixType] (node_modules/@babel/parser/src/plugins/flow/index.ts:1797:21)
      at FlowParserMixin.flowParsePrefixType [as flowParseAnonFunctionWithoutParens] (node_modules/@babel/parser/src/plugins/flow/index.ts:1802:26)
      at FlowParserMixin.flowParseAnonFunctionWithoutParens [as flowParseIntersectionType] (node_modules/@babel/parser/src/plugins/flow/index.ts:1821:25)
      at FlowParserMixin.flowParseIntersectionType [as flowParseUnionType] (node_modules/@babel/parser/src/plugins/flow/index.ts:1834:25)
      at FlowParserMixin.flowParseUnionType [as flowParseType] (node_modules/@babel/parser/src/plugins/flow/index.ts:1847:25)
      at FlowParserMixin.flowParseType [as flowParseTypeInitialiser] (node_modules/@babel/parser/src/plugins/flow/index.ts:353:25)
      at FlowParserMixin.flowParseTypeInitialiser [as flowParseTypeAlias] (node_modules/@babel/parser/src/plugins/flow/index.ts:818:25)
      at FlowParserMixin.flowParseTypeAlias [as parseExpressionStatement] (node_modules/@babel/parser/src/plugins/flow/index.ts:1994:25)
      at FlowParserMixin.parseExpressionStatement [as parseStatementContent] (node_modules/@babel/parser/src/parser/statement.ts:659:19)
      at FlowParserMixin.parseStatementContent (node_modules/@babel/parser/src/parser/statement.ts:426:17)
      at FlowParserMixin.parseStatementLike (node_modules/@babel/parser/src/plugins/flow/index.ts:1962:26)
      at FlowParserMixin.parseStatementLike [as parseModuleItem] (node_modules/@babel/parser/src/parser/statement.ts:363:17)
      at FlowParserMixin.parseModuleItem [as parseBlockOrModuleBlockBody] (node_modules/@babel/parser/src/parser/statement.ts:1395:16)
      at FlowParserMixin.parseBlockOrModuleBlockBody [as parseBlockBody] (node_modules/@babel/parser/src/parser/statement.ts:1369:10)
      at FlowParserMixin.parseBlockBody [as parseProgram] (node_modules/@babel/parser/src/parser/statement.ts:217:10)
      at FlowParserMixin.parseProgram (node_modules/@babel/parser/src/parser/statement.ts:199:25)
      at FlowParserMixin.parseTopLevel (node_modules/@babel/parser/src/plugins/flow/index.ts:3319:30)
      at FlowParserMixin.parseTopLevel [as parse] (node_modules/@babel/parser/src/parser/index.ts:46:10)
      at parse (node_modules/@babel/parser/src/index.ts:65:38)
      at parser (node_modules/@babel/core/src/parser/index.ts:28:19)
          at parser.next (<anonymous>)
      at normalizeFile (node_modules/@babel/core/src/transformation/normalize-file.ts:50:24)
          at normalizeFile.next (<anonymous>)
      at run (node_modules/@babel/core/src/transformation/index.ts:39:36)
          at run.next (<anonymous>)
      at transform (node_modules/@babel/core/src/transform.ts:29:20)
          at transform.next (<anonymous>)
      at evaluateSync (node_modules/gensync/index.js:251:28)
      at sync (node_modules/gensync/index.js:89:14)
      at fn (node_modules/@babel/core/src/errors/rewrite-stack-trace.ts:99:14)
      at transformSync (node_modules/@babel/core/src/transform.ts:66:52)
      at ScriptTransformer.transformSource (node_modules/@jest/transform/build/ScriptTransformer.js:545:31)
      at ScriptTransformer._transformAndBuildScript (node_modules/@jest/transform/build/ScriptTransformer.js:674:40)
      at ScriptTransformer.transform (node_modules/@jest/transform/build/ScriptTransformer.js:726:19)
      at Object.require (node_modules/react-native/Libraries/EventEmitter/RCTDeviceEventEmitter.js:14:1)
      at Object.require (node_modules/react-native/Libraries/Utilities/Dimensions.js:11:1)
      at Object.require (node_modules/react-native/Libraries/Utilities/PixelRatio.js:13:20)
      at Object.require (node_modules/react-native/Libraries/StyleSheet/StyleSheet.js:29:20)
      at Object.require (node_modules/react-native/Libraries/NewAppScreen/components/DebugInstructions.js:13:1)
      at Object.require (node_modules/react-native/Libraries/NewAppScreen/index.js:12:1)
      at Object.require (App.tsx:20:1)
      at Object.require (__tests__/App.test.tsx:7:1)

Reproducer

https://github.com/mdjastrzebski/rn-0.76-nightly-test

Screenshots and Videos

No response

@cipolleschi
Copy link
Contributor

@mdjastrzebski thanks for flagging this!
We identified the root cause in this commit: 464a202

We have to update the Flow syntax Babel plugin used by Jest but this problem should not give issues at runtime.
Also, is a bit weird as we should be using the Hermes parser for Flow in Jest tests, but it looks like we are not? 🤔
@huntie @robhogan has more expertise in this area.

@mdjastrzebski
Copy link
Contributor Author

@cipolleschi thanks for checking this. I've run into this when I wanted to check how RN 0.76 + React 19 would work with RN Testing Library. I'll wait for a fix and resume my checks afterwards.

@cipolleschi
Copy link
Contributor

I wanted to check how RN 0.76 + React 19

Given that React 19 has not been released as stable yet, we are reverting the React 19 bump.
React native 0.76 will ship with React 18.3.1

huntie pushed a commit to huntie/react-native that referenced this issue Sep 12, 2024
Summary:
Resolves facebook#46355.

Changelog: [Internal]

Differential Revision: D62583337
huntie added a commit to huntie/react-native that referenced this issue Sep 12, 2024
Summary:
Resolves facebook#46355.

Changelog: [Internal]

Differential Revision: D62583337
huntie pushed a commit to huntie/react-native that referenced this issue Sep 12, 2024
Summary:
Resolves facebook#46355.

Changelog: [Internal]

Differential Revision: D62583337
huntie pushed a commit to huntie/react-native that referenced this issue Sep 13, 2024
Summary:
Resolves facebook#46355.

Changelog: [Internal]

Differential Revision: D62583337
huntie pushed a commit to huntie/react-native that referenced this issue Sep 16, 2024
Summary:
Resolves facebook#46355.

Changelog: [Internal]

Differential Revision: D62583337
huntie added a commit to huntie/react-native that referenced this issue Sep 16, 2024
Summary:
Pull Request resolved: facebook#46465

Resolves facebook#46355.

Changelog: [Internal]

Reviewed By: robhogan

Differential Revision: D62583337
huntie added a commit to huntie/react-native that referenced this issue Sep 16, 2024
Summary:
Pull Request resolved: facebook#46465

Resolves facebook#46355.

Changelog: [Internal]

bypass-github-export-checks

Reviewed By: robhogan

Differential Revision: D62583337
huntie pushed a commit to huntie/react-native that referenced this issue Sep 16, 2024
Summary:
Pull Request resolved: facebook#46465

Resolves facebook#46355.

Changelog: [Internal]

bypass-github-export-checks

Differential Revision: D62583337

Reviewed By: robhogan
@cortinico cortinico added the Resolution: Fixed A PR that fixes this issue has been merged. label Sep 16, 2024
blakef pushed a commit that referenced this issue Sep 23, 2024
Summary:
Pull Request resolved: #46465

Resolves #46355.

Changelog: [Internal]

bypass-github-export-checks

Reviewed By: robhogan

Differential Revision: D62583337

fbshipit-source-id: 64813d84c2a6395be8ef4f138398834ddae6e54b
@dannyhw
Copy link

dannyhw commented Oct 27, 2024

im getting this same issue with react 18.3 and react native 0.76, whats the solution?

edit:
just applied the changed in #46465 to my project jest config

  transform: {
    '^.+\\.(js)$': ['babel-jest', { plugins: ['babel-plugin-syntax-hermes-parser'] }],
    '^.+\\.(ts|tsx)$': 'babel-jest',
  },

and I was able to get past the error

seems like it should automatically get applied though, my setup could be messed up

@shameemkpofficial-git
Copy link

and react native 0.76, whats

am also facing this same issue. I have tried with changing the NDK versions: make newArchEnabled=false. It doesn't work for me.

@huntie
Copy link
Member

huntie commented Oct 29, 2024

@dannyhw @shameem The correct starting Jest config is per the template — make sure your preset is react-native.

https://github.com/react-native-community/template/blob/32b7247d68a309677a945a85720d0d3331b8422a/template/jest.config.js#L1-L3

@dannyhw
Copy link

dannyhw commented Oct 29, 2024

@huntie this is my config now, I added the transform part to fix the problem

/** @type {import('jest').Config} */
const config = {
  preset: 'react-native',
  modulePathIgnorePatterns: ['dist/'],
  moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
  transformIgnorePatterns: ['node_modules/(?!react-native|@react-native)'],
  setupFilesAfterEnv: ['<rootDir>/../../node_modules/react-native-gesture-handler/jestSetup.js'],
  transform: {
    '^.+\\.(js)$': ['babel-jest', { plugins: ['babel-plugin-syntax-hermes-parser'] }],
    '^.+\\.(ts|tsx)$': 'babel-jest',
  },
};
module.exports = config;

from this pr

storybookjs/react-native#634

basically when i upgraded dependencies I started getting the error

But to be fair my setup is kinda unusual.

@carloscuesta
Copy link
Contributor

@huntie I'm using the recommended preset and I still need to define the transform in my jest config to fix the error when running jest tests, see: carloscuesta/react-native-error-boundary#891

@BryarGh
Copy link

BryarGh commented Nov 9, 2024

@huntie @robhogan Sorry for the tag but been dealing with this dead-end bug and couldn't resolve it.
I'm getting this error in this:

ERROR  SyntaxError: /Users/bryarghafoor/Desktop/SoundwillClub-main/node_modules/react-native/Libraries/vendor/emitter/EventEmitter.js: Unexpected token, expected "]" (39:5)

 37 |
 38 | type Registry<TEventToArgsMap: {...}> = {
> 39 |   [K in keyof TEventToArgsMap]: Set<Registration<TEventToArgsMap[K]>>,
    |      ^
 40 | };
 41 |
 42 | /**

My Setup:
Environment:
React: 18.3.1
React Native: 0.76.0
react-test-renderer: 18.3.1
Jest: 29.7.0
babel-jest: 29.7.0
Metro: 0.81.0
Node.js: 18.20.4
MacOs: M2 Pro

I tested it with React-native 0.76 and 0.76.1 still the same issue or error! What to do?

I have even tried this solution:

"jest": {
    "preset": "react-native",
    "transformIgnorePatterns": [
      "node_modules/(?!react-native|@react-native)"
    ],
    "transform": {
      "^.+\\.(js)$": [
        "babel-jest",
        {
          "plugins": [
            "babel-plugin-syntax-hermes-parser"
          ]
        }
      ],
      "^.+\\.(ts|tsx)$": "babel-jest"
    },
    "moduleFileExtensions": [
      "ts",
      "tsx",
      "js",
      "jsx",
      "json",
      "node"
    ]
  }

This was an old react-native project, I removed deprecated plugins and only kept those that can be upgraded and replaced others.. but now am in this dead end bug...

This is my package.json

{
  "name": "soundwill",
  "version": "2.5.1",
  "private": true,
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "start": "react-native start",
    "test": "jest",
    "lint": "eslint . --ext .js,.jsx,.ts,.tsx",
    "build:ios": "npx react-native bundle --entry-file='index.js' --bundle-output='./ios/main.jsbundle' --dev=false --platform='ios'",
    "build:android": "npx react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res/ && rm -rf ./android/app/src/main/res/drawable-mdpi/ && rm -rf ./android/app/src/main/res/raw/",
    "release": "yarn build && cd ./android && ./gradlew bundleRelease"
  },
  "dependencies": {
    "@eva-design/eva": "^2.2.0",
    "@react-native-community/cli": "^15.1.2",
    "@react-native-community/cli-platform-android": "^15.1.2",
    "@react-native-community/masked-view": "^0.1.11",
    "@react-native-community/template": "^0.76.1",
    "@react-native-firebase/app": "^21.4.0",
    "@react-native-firebase/messaging": "^21.4.0",
    "@react-native/codegen": "^0.76.1",
    "@react-navigation/bottom-tabs": "^7.0.0",
    "@react-navigation/core": "^7.0.0",
    "@react-navigation/drawer": "^7.0.0",
    "@react-navigation/material-top-tabs": "^7.0.1",
    "@react-navigation/native": "^7.0.0",
    "@react-navigation/stack": "^7.0.0",
    "@reduxjs/toolkit": "^2.3.0",
    "@types/react-redux": "^7.1.34",
    "@ui-kitten/components": "^5.3.1",
    "@ui-kitten/eva-icons": "5.3.1",
    "axios": "^1.7.7",
    "expo-sharing": "^12.0.1",
    "formik": "^2.4.6",
    "i18n-js": "^4.5.0",
    "metro": "^0.81.0",
    "metro-core": "^0.81.0",
    "react": "18.3.1",
    "react-native": "^0.76.0",
    "react-native-atoz-listview": "0.0.7",
    "react-native-camera": "^4.2.1",
    "react-native-dropdownalert": "^5.1.0",
    "react-native-eject": "^1.0.1",
    "react-native-fast-image": "^8.6.3",
    "react-native-flash-message": "^0.4.2",
    "react-native-gesture-handler": "^2.20.2",
    "react-native-image-crop-picker": "^0.41.4",
    "react-native-image-slider-box": "^2.0.7",
    "react-native-input-spinner": "^1.8.1",
    "react-native-keyboard-aware-scroll-view": "^0.9.5",
    "react-native-loading-spinner-overlay": "^3.0.1",
    "react-native-pdf": "^6.7.5",
    "react-native-permissions": "^5.1.0",
    "react-native-qrcode-scanner": "^1.5.5",
    "react-native-reanimated": "3.16.1",
    "react-native-restart": "^0.0.27",
    "react-native-safe-area-context": "^4.14.0",
    "react-native-screens": "^4.0.0",
    "react-native-search-box": "0.0.20",
    "react-native-share": "^11.0.4",
    "react-native-splash-screen": "^3.3.0",
    "react-native-store-version": "^1.4.1",
    "react-native-svg": "^15.8.0",
    "react-native-tab-view": "^4.0.1",
    "react-native-tracking-transparency": "^0.1.2",
    "react-native-version-number": "^0.3.6",
    "react-native-webview": "^13.12.3",
    "react-redux": "^9.1.2",
    "shopify-buy": "^2.22.0",
    "uuid": "^11.0.2",
    "yup": "^1.4.0"
  },
  "devDependencies": {
    "@babel/core": "^7.26.0",
    "@babel/plugin-proposal-class-properties": "^7.18.6",
    "@babel/plugin-proposal-decorators": "^7.25.9",
    "@babel/preset-flow": "^7.24.7",
    "@babel/runtime": "^7.26.0",
    "@react-native-community/eslint-config": "^3.2.0",
    "@types/jest": "^29.5.14",
    "@types/react-native": "^0.73.0",
    "@types/react-test-renderer": "18.3.0",
    "@typescript-eslint/eslint-plugin": "^8.13.0",
    "@typescript-eslint/parser": "^8.13.0",
    "@ui-kitten/metro-config": "^5.3.1",
    "babel-cli": "^6.26.0",
    "babel-jest": "^29.7.0",
    "babel-plugin-syntax-hermes-parser": "^0.25.0",
    "eslint": "^9.14.0",
    "jest": "^29.7.0",
    "metro-react-native-babel-preset": "^0.77.0",
    "metro-react-native-babel-transformer": "^0.77.0",
    "prettier": "^3.3.3",
    "react-native-svg-transformer": "^1.5.0",
    "react-test-renderer": "18.3.1",
    "typescript": "^5.6.3"
  },
  "jest": {
    "preset": "react-native",
    "transformIgnorePatterns": [
      "node_modules/(?!react-native|@react-native)"
    ],
    "transform": {
      "^.+\\.(js)$": [
        "babel-jest",
        {
          "plugins": [
            "babel-plugin-syntax-hermes-parser"
          ]
        }
      ],
      "^.+\\.(ts|tsx)$": "babel-jest"
    },
    "moduleFileExtensions": [
      "ts",
      "tsx",
      "js",
      "jsx",
      "json",
      "node"
    ]
  }
}

@huntie
Copy link
Member

huntie commented Nov 11, 2024

@BryarGh Please try:

Note that the intended config within our Jest + Babel presets is here (latest relevant fix PR): 1387f52#diff-23432c49a1b0fbaa32ac0db0694a712f12f58619619948137f2cccf282fa61ceL28. We do expect projects to work out-of-the-box with these combined settings, which were shipped in 0.76.0.

@carloscuesta
Copy link
Contributor

Hey! I was able to narrow down the issue thanks to @huntie's last comment.

In my case problem was that the @react-native/babel-preset dependency was still using 0.75.3 as soon as I updated that to 0.76.1 I was able to remove the custom transform!

Reference: carloscuesta/react-native-error-boundary#897

@huntie
Copy link
Member

huntie commented Nov 12, 2024

Awesome. Yeah a general thing to note is that react-native and all @react-native/* dependencies in projects MUST be updated in lockstep at their exact versions to guarantee compatibility (or at least matching the tested state in our monorepo).

e.g. These should all be at "0.76.1" presently in your package.json:

https://github.com/react-native-community/template/blob/ba029fb56e416d1d35ef77caa27f418a14db4717/template/package.json#L23-L26

@carloscuesta
Copy link
Contributor

Yup! I would've catched those while updating manually but did not with Dependabot, thanks for the help! 🙏🏼

@ravindraguptacapgemini
Copy link

ravindraguptacapgemini commented Nov 27, 2024

@cipolleschi I am on RN 0.76.3, and facing this issue because I am using older version 0.75.3 for @react-native/babel-preset due to underlying issue with flow typed files #47933

@cipolleschi
Copy link
Contributor

I see that @huntie replied to you in the other issue. Let's move the conversation there.

@goblin225
Copy link

BUNDLE ./index.js

ERROR SyntaxError: E:\user\dev\my_ems_app\node_modules\react-native\Libraries\vendor\emitter\EventEmitter.js: Unexpected token, expected "]" (39:5)

37 |
38 | type Registry<TEventToArgsMap: {...}> = {

39 | [K in keyof TEventToArgsMap]: Set<Registration<TEventToArgsMap[K]>>,
| ^
40 | };
41 |
42 | /**

How to fix the problem any one help?

@cipolleschi
Copy link
Contributor

@goblin225 please update to the most recent version of React Native. We already fixed this.

@danelkungla
Copy link

im using 0.76.5 and the issue is still there

@YohanisTaye87
Copy link

i am using "react": "^19.0.0",
"react-native": "0.76.5"

but the issue is still there 

@srahul99
Copy link

srahul99 commented Jan 3, 2025

I am also facing same issue, any temperory solution for this?

@cipolleschi
Copy link
Contributor

@huntie Is there something else that should be done?
My understanding is that this is fixed for good, or is there some configuration that needs to be applied?

@huntie
Copy link
Member

huntie commented Jan 3, 2025

@YohanisTaye87 @srahul99 Please ensure ALL react-native and @react-native/* dependencies in your project are updated to the latest release (at time of writing, 0.76.5).

  • In the case of this bug, it's specifically the @react-native/babel-plugin dependency that needs updating.
  • Please also check your Babel config in case of any parser, plugins overrides that may conflict.

@BryarGh
Copy link

BryarGh commented Jan 4, 2025

I had the same issue and struggled with it, it had been fixed but what I did... I started updating my project slowly but surly to avoid this issue again. The first time, I did bulk update of packages but second time .. All were good and worked out fine for me.

@srahul99
Copy link

srahul99 commented Jan 5, 2025

  Not working ,

{
"name": "testApp",
"version": "0.0.1",
"private": true,
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"lint": "eslint .",
"start": "react-native start",
"test": "jest",
"postinstall": "patch-package"
},
"dependencies": {
"@react-native-async-storage/async-storage": "^2.1.0",
"@react-native-clipboard/clipboard": "^1.15.0",
"@react-native-community/masked-view": "^0.1.11",
"@react-native-community/push-notification-ios": "^1.11.0",
"@react-native-firebase/app": "^21.6.2",
"@react-native-firebase/messaging": "^21.6.2",
"@react-navigation/bottom-tabs": "^7.2.0",
"@react-navigation/drawer": "^7.1.1",
"@react-navigation/material-top-tabs": "^7.1.0",
"@react-navigation/native": "^7.0.14",
"@react-navigation/stack": "^7.1.1",
"@reduxjs/toolkit": "^2.5.0",
"@shankarmorwal/rn-viewpager": "^1.3.1",
"@tradle/react-native-http": "^2.0.1",
"appcenter": "5.0.2",
"assert": "^2.1.0",
"axios": "^1.7.9",
"babel-plugin-module-resolver": "^5.0.2",
"browserify-zlib": "^0.2.0",
"buffer": "^6.0.3",
"colord": "^2.9.3",
"console-browserify": "^1.2.0",
"constants-browserify": "^1.0.0",
"dns.js": "^1.0.1",
"domain-browser": "^5.7.0",
"events": "^3.3.0",
"https-browserify": "^1.0.0",
"i": "^0.3.7",
"install": "^0.13.0",
"jetifier": "^2.0.0",
"jwt-decode": "^4.0.0",
"lodash.debounce": "^4.0.8",
"moment": "^2.30.1",
"moment-timezone": "^0.5.46",
"npm": "^11.0.0",
"path-browserify": "^1.0.1",
"process": "^0.11.10",
"punycode": "^2.3.1",
"querystring-es3": "^0.2.1",
"react": "^18.3.1",
"react-dom": "^19.0.0",
"react-fast-compare": "^3.2.2",
"react-i18next": "^15.4.0",
"react-native": "^0.76.5",
"react-native-bouncy-checkbox": "^4.1.2",
"react-native-copilot": "^3.3.3",
"react-native-device-info": "^14.0.2",
"react-native-dotenv": "^3.4.11",
"react-native-dropdown-picker": "^5.4.6",
"react-native-element-dropdown": "^2.12.2",
"react-native-encrypted-storage": "^4.0.3",
"react-native-gesture-handler": "^2.21.2",
"react-native-html-to-pdf": "^0.12.0",
"react-native-keyboard-aware-scroll-view": "^0.9.5",
"react-native-level-fs": "^3.0.1",
"react-native-linear-gradient": "^2.8.3",
"react-native-modal": "^13.0.1",
"react-native-os": "^1.2.6",
"react-native-pager-view": "^6.6.1",
"react-native-permissions": "^5.2.2",
"react-native-push-notification": "^8.1.1",
"react-native-quick-crypto": "^0.7.11",
"react-native-reanimated": "^3.16.6",
"react-native-safe-area-context": "^5.0.0",
"react-native-screens": "^4.4.0",
"react-native-svg": "^15.10.1",
"react-native-svg-transformer": "^1.5.0",
"react-native-tab-view": "^4.0.5",
"react-native-tcp": "^4.0.0",
"react-native-udp": "^4.1.7",
"react-native-vector-icons": "^10.2.0",
"react-redux": "^9.2.0",
"readable-stream": "^4.6.0",
"stream": "^0.0.3",
"stream-browserify": "^3.0.0",
"string_decoder": "^1.3.0",
"styled-components": "^6.1.14",
"timers-browserify": "^2.0.12",
"tty-browserify": "^0.0.1",
"url": "^0.11.4",
"util": "^0.12.5",
"vm-browserify": "^1.1.2"
},
"devDependencies": {
"@babel/core": "^7.25.2",
"@babel/preset-env": "^7.25.3",
"@babel/runtime": "^7.25.0",
"@react-native-community/cli": "15.0.1",
"@react-native-community/cli-platform-android": "15.0.1",
"@react-native-community/cli-platform-ios": "15.0.1",
"@react-native/babel-preset": "0.76.5",
"@react-native/eslint-config": "0.76.5",
"@react-native/metro-config": "0.76.5",
"@react-native/typescript-config": "0.76.5",
"@types/react": "^18.2.6",
"@types/react-test-renderer": "^18.0.0",
"babel-jest": "^29.6.3",
"eslint": "^8.19.0",
"jest": "^29.6.3",
"metro-react-native-babel-preset": "^0.77.0",
"prettier": "2.8.8",
"react-test-renderer": "18.3.1",
"typescript": "5.0.4"
},
"engines": {
"node": ">=18"
}
}

@huntie huntie changed the title test script fails in 0.76-nightlty [Fixed in @react-native/babel-preset 0.76.4] Projects using Babel may hit syntax error in EventEmitter.js and/or syntax plugin incompatibility Jan 6, 2025
@huntie
Copy link
Member

huntie commented Jan 6, 2025

I've updated the issue title to reflect the later user facing bug that became prevalent in comments.

(Meta only: this is the continued fallout of S472044.)

@huntie huntie changed the title [Fixed in @react-native/babel-preset 0.76.4] Projects using Babel may hit syntax error in EventEmitter.js and/or syntax plugin incompatibility [Fixed in @react-native/babel-preset 0.76.4] Syntax error in EventEmitter.js when using Babel Jan 7, 2025
@shijoavb
Copy link

shijoavb commented Jan 8, 2025

#48228 (comment)

This resolved

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Flow Resolution: Fixed A PR that fixes this issue has been merged.
Projects
None yet
Development

Successfully merging a pull request may close this issue.