software-mansion / react-native-reanimated

React Native's Animated library reimplemented
https://docs.swmansion.com/react-native-reanimated/
MIT License
8.58k stars 1.26k forks source link

Unexpected token: punc ()) in file node_modules/react-native-reanimated/src/createAnimatedComponent/createAnimatedComponent.tsx #6170

Closed kitkline closed 2 days ago

kitkline commented 3 days ago

Description

React Native: 0.74.1 react-native-reanimated: 3.12.1 Gradle: 8.6 JDK: 17.0.3.1

Running: react-native bundle --platform android

Fails with:

error node_modules/react-native-reanimated/src/createAnimatedComponent/createAnimatedComponent.tsx: Unexpected token: punc ()) in file node_modules/react-native-reanimated/src/createAnimatedComponent/createAnimatedComponent.tsx at 462:77. Error: Unexpected token: punc ()) in file node_modules/react-native-reanimated/src/createAnimatedComponent/createAnimatedComponent.tsx at 462:77 at minifyCode (/Users/kitkline/Development/Clients/gearlogapp/node_modules/metro-transform-worker/src/index.js:74:13) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async transformJS (/Users/kitkline/Development/Clients/gearlogapp/node_modules/metro-transform-worker/src/index.js:240:22) at async transformJSWithBabel (/Users/kitkline/Development/Clients/gearlogapp/node_modules/metro-transform-worker/src/index.js:298:10) at async Object.transform (/Users/kitkline/Development/Clients/gearlogapp/node_modules/metro-transform-worker/src/index.js:412:12)

Steps to reproduce

react-native bundle --platform android

Simply trying to run bundle causes the error

Snack or a link to a repository

Cannot

Reanimated version

3.12.1

React Native version

0.74.1

Platforms

Android, iOS

JavaScript runtime

Hermes

Workflow

React Native

Architecture

Paper (Old Architecture)

Build type

Debug app & production bundle

Device

Android emulator

Device model

No response

Acknowledgements

Yes

github-actions[bot] commented 3 days ago

Hey! 👋

The issue doesn't seem to contain a minimal reproduction.

Could you provide a snack or a link to a GitHub repository under your username that reproduces the problem?

szydlovsky commented 2 days ago

@kitkline have you tried cleaning node modules and other caches? Run git clean -xdf and then re-install all dependencies.

kitkline commented 2 days ago

@szydlovsky Thanks for that suggestion. What I had done was:

gradlew clean watchman watch-del-all && rm -rf node_modules/ rm -rf $TMPDIR/react-native-packager-cache- rm -rf $TMPDIR/metro-bundler-cache- npm start -- --reset-cache react-native start --reset-cache

None of those helped.

Would you suggest I also delete the whole node_modules folder and run a npm install to repopulate it? Are there any other caches I can clear that might help?

Does it look like an issue with stale cache code or and out of date library rather than an issue in the current version of reanimated? I do get that same issue if I try earlier versions as well...

Cheers Kit

Thanks for your help and input

szydlovsky commented 2 days ago

@kitkline Thanks for a reply. Yes, I'd suggest deleting whole node_modules and repopulating it. If this still doesn't help I'll try reproducing it myself

kitkline commented 2 days ago

@szydlovsky yeah that got it - below the full list of what I cleared - I suspect actually it was the full delete of .gradle after gradle stop that actually got it... Thanks for the suppport

gradlew --stop

sudo rm -rf ~/.gradle/caches/ sudo rm -rf $GRADLE_HOME/caches/build-cache-*

OR replace above two with

sudo rm -rf ~/.gradle/

sudo watchman watch-del-all rm -rf node_modules/ rm -rf $TMPDIR/react-native-packager-cache- rm -rf $TMPDIR/metro-bundler-cache- npm install --legacy-peer-deps npm start -- --reset-cache react-native start --reset-cache