react-native-reanimated: V3 Failed to create a worklet. Did you forget to add Reanimated Babel plugin in babel.config.js?
Description
Error: Failed to create a worklet. Did you forget to add Reanimated Babel plugin in babel.config.js?
This error appeared randomly when i was rebuilding my application on an update branch (didn’t do any particular change to packages when the error popped up, and i already had rebuilt many times the app on this branch), in production everything works fine an correctly, but when i try to launch the app on the simulator this error pops up, both on android and ios, this is a preview of my babel.config.js:
module.exports = { presets: ['module:metro-react-native-babel-preset'], plugins: [ ['module:react-native-dotenv', { 'envName': 'APP_ENV', 'moduleName': 'react-native-dotenv', 'path': '.env' }], 'react-native-reanimated/plugin' ] };
is there something i’m missing? i didn’t actually change anything and even clearing the whole env many times and restarting the pc didn’t actually solve anything (i’ve also tried to go with npm start – --reset-cache but nothing)
I’ve found other issues on the repo, also from reanimated v2 but every solution was leading to the babel.config.js, and to me mine looks correct.
Steps to reproduce
- npm start --reset-cache
Snack or a link to a repository
The repo is private
Reanimated version
3.2.0
React Native version
0.71.8
Platforms
Android, iOS
JavaScript runtime
Hermes
Workflow
React Native (without Expo)
Architecture
Fabric (New Architecture)
Build type
Debug mode
Device
iOS simulator
Device model
No response
Acknowledgements
Yes
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 11
- Comments: 31 (5 by maintainers)
Issue persists for RN: 0.73 RNA: 3.6.1
bable config:
checked the compatibility here https://docs.swmansion.com/react-native-reanimated/docs/guides/compatibility/
edit:
tried everything cleaning cache, reinstalling node modules, gradle clean build with every combination and nothing worked
@tomekzaw i have the same issues, but the fixes in your PR work.
to be honest, i don’t really know what i did to fix it, but try cleaniung everything and running with npm start – --reset-cache
Not working for me as well package.json dependencies :
babel.config.js
Any solution? This problem is still present when I try to run const Drawer = createDrawerNavigator() from “@react-navigation/drawer”@jean-marc-cp o @domenicoprestia
@peterjskaltsis You can use
yarn install react-native-reanimated@nightly
or wait for 3.3.0 (probably early next week).I was facing the same issue
running
npx expo start -c
in my terminal solved this issueActually in my case the error didn’t pop up on the update but on a clean boot of the application (deleting node_modules, package-lock.json, Pods and Podfile.lock)
adding resetCache: true, in metro.config.js solved my problem
@0xdevanshu There’s a problem in your
babel.config.js
, please move the square bracket, reset Metro cache and try again:@gilhrpenner Reanimated docs clearly state that you need to add
react-native-reanimated/plugin
in top-levelplugins
, not insideenv.production.plugins
.i am also having this problem. here is my babel.config
It seems strange, can you provide a minimal reproduction repo? Maybe it isn’t related to this issue, what is your babel config?
Hey @domenicoprestia, thanks for reporting this issue. Can you please check if #4511 fixes your problem?