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

i am upgrading react native version 0.75.2 T0 0.76.5 But i am gtting issue unable to run project / I am using javaScript #48228

Closed
harisheligarf opened this issue Dec 12, 2024 · 3 comments
Labels
Needs: Author Feedback Needs: Repro This issue could be improved with a clear list of steps to reproduce the issue. Resolution: For Stack Overflow A question for Stack Overflow. Applying this label will cause issue to be closed.

Comments

@harisheligarf
Copy link

Description

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

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

ERROR SyntaxError: /Users/harishpalsande/Desktop/projects/native/imeuswe-mobile-native/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 | /**
BUNDLE ./index.js

ERROR SyntaxError: /Users/harishpalsande/Desktop/projects/native/imeuswe-mobile-native/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 | /**

Steps to reproduce

upgrading react native version 0.75.2 T0 0.76.5

React Native Version

0.76.5

Affected Platforms

Runtime - Android, Runtime - iOS

Output of npx react-native info

System:
  OS: macOS 15.1.1
  CPU: (8) arm64 Apple M3
  Memory: 120.39 MB / 16.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 20.17.0
    path: ~/.nvm/versions/node/v20.17.0/bin/node
  Yarn:
    version: 1.22.22
    path: /opt/homebrew/bin/yarn
  npm:
    version: 10.9.0
    path: ~/.nvm/versions/node/v20.17.0/bin/npm
  Watchman:
    version: 2024.11.18.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: Not Found
IDEs:
  Android Studio: 2024.2 AI-242.23339.11.2421.12483815
  Xcode:
    version: 16.0/16A242d
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.11
    path: /usr/bin/javac
  Ruby:
    version: 2.6.10
    path: /usr/bin/ruby
npmPackages:
  "@react-native-community/cli":
    installed: 15.0.1
    wanted: 15.0.1
  react:
    installed: 18.3.1
    wanted: 18.3.1
  react-native:
    installed: 0.76.0
    wanted: 0.76.42
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: true
  newArchEnabled: true

Stacktrace or Logs

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

 ERROR  SyntaxError: /Users/harishpalsande/Desktop/projects/native/imeuswe-mobile-native/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 | /**
 BUNDLE  ./index.js 

 ERROR  SyntaxError: /Users/harishpalsande/Desktop/projects/native/imeuswe-mobile-native/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 | /**

Reproducer

d

Screenshots and Videos

No response

@react-native-bot react-native-bot added Needs: Author Feedback Needs: Repro This issue could be improved with a clear list of steps to reproduce the issue. labels Dec 12, 2024
@react-native-bot
Copy link
Collaborator

Warning

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

@harisheligarf harisheligarf changed the title i am upgrading react native version 0.75.2 T0 0.76.5 But i am gtting issue unable to run project i am upgrading react native version 0.75.2 T0 0.76.5 But i am gtting issue unable to run project / I am using javaScript Dec 12, 2024
@cortinico cortinico added the Resolution: For Stack Overflow A question for Stack Overflow. Applying this label will cause issue to be closed. label Dec 12, 2024
@react-native-bot
Copy link
Collaborator

Note

Not a bug report: This issue looks like a question. We are using GitHub issues exclusively to track bugs in React Native. GitHub may not be the ideal place to ask a question, but you can try asking over on Stack Overflow, or on Reactiflux.

@Basil-Code
Copy link

I managed to fix this issue by replacing presets: ['module:metro-react-native-babel-preset'], with presets: ['module:@react-native/babel-preset'], in both babel.config.js & .babelrc

shankari added a commit to shankari/e-mission-phone that referenced this issue Dec 21, 2024
This fixes the code coverage github action.

Without this change, we were getting the error

```
i FAIL  www/__tests__/DateSelect.test.tsx
  ● Test suite failed to run

    SyntaxError: /private/tmp/e-mission-phone/node_modules/react-native/Libraries/vendor/emitter/EventEmitter.js: Unexpected token, expected "]" (39:5)
```

The last successful run was from Oct 17.
The first failed run was from Oct 23.

We have not made any changes to the react-native components that we directly
import since Sept 2024. However, we use a carat semver, so we will pull newly
released minor versions. One of our dependencies bumped up the version of RN
that they use, and released a new minor version, which broke this.

After fruitlessly searching around for a root cause (as documented in the PR
comments), since we import a lot of components and it was laborious to check
when each of them have been updated, I did a brute force search in GitHub for
this error and found both the same issue
facebook/react-native#48228
and a fix that worked
facebook/react-native#48228 (comment)

I am surprised this has not been reported widely, but I guess it is fairly new!
Thanks to @Basil-Code for the suggestion!
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: For Stack Overflow A question for Stack Overflow. Applying this label will cause issue to be closed.
Projects
None yet
Development

No branches or pull requests

4 participants