facebook / metro

🚇 The JavaScript bundler for React Native
https://metrobundler.dev
MIT License
5.24k stars 626 forks source link

SyntaxError in node_modules/react-native/src/private/animated/NativeAnimatedHelper.js: '}' #1382

Open mrouah-qualisocial opened 2 weeks ago

mrouah-qualisocial commented 2 weeks ago

Do you want to request a feature or report a bug?

bug

What is the current behavior?

after bundle.js compilation throw SyntaxError

SyntaxError in node_modules/react-native/src/private/animated/NativeAnimatedHelper.js: '}' expected at end of object literal '{...' (138:9) }) as $NonMaybeType['getValue'], ^ note: location of '{' (126:12) const API = {

Please provide your exact Metro configuration and mention your Metro, node, yarn/npm version and operating system.

System: OS: macOS 14.2.1 CPU: (10) arm64 Apple M2 Pro Memory: 98.05 MB / 16.00 GB Shell: version: "5.9" path: /bin/zsh Binaries: Node: version: 18.18.2 path: /usr/local/bin/node Yarn: version: 1.22.22 path: /usr/local/bin/yarn npm: version: 10.9.0 path: ~/dev/qualicare_0_76_1/node_modules/.bin/npm Watchman: version: 2024.04.01.00 path: /opt/homebrew/bin/watchman Managers: CocoaPods: version: 1.14.3 path: /usr/local/bin/pod SDKs: iOS SDK: Platforms:

tylerku commented 2 weeks ago

I am also experiencing this. Just upgraded my app to use React Native 0.76.1

mrouah-qualisocial commented 2 weeks ago

same error with React Native 0.76.1

huntie commented 2 weeks ago

Related to https://github.com/facebook/react-native/issues/46601.

nchkr commented 1 week ago

@huntie any updates on this issue ?

huntie commented 1 week ago

@nchkr This should be fixed as of React Native 0.76.1. Please update all your @react-native/* deps (the fix is part of @react-native/babel-preset).

nchkr commented 1 week ago

After updating RN to 0.76.1 still getting the same error :

SyntaxError: /node_modules/react-native/src/private/animated/NativeAnimatedHelper.js: Unexpected token, expected "," (138:9)

  136 |     : (tag, saveValueCallback) => {
  137 |         NativeOperations.getValue(tag, saveValueCallback);
> 138 |       }) as $NonMaybeType<typeof NativeAnimatedModule>['getValue'],
      |          ^
  139 |
  140 |   setWaitingForIdentifier(id: string): void {
  141 |     waitingForQueuedOperations.add(id);
NoodleOfDeath commented 1 week ago

Yup getting the same error too. I am downgrading back to 0.73.4

DimitarNestorov commented 3 days ago

@nchkr @NoodleOfDeath please update babel.config.js

  module.exports = {
-   presets: ['module:metro-react-native-babel-preset'],
+   presets: ['module:@react-native/babel-preset'],
  };
Unn4m3DD commented 22 hours ago

The babel.config.js alone did not fix it on my side. It had to do with react-native-svg-transformer. I npm i react-native-svg-transformer@latest and it started working