DEV Community

Cover image for Error: Failed to create a worklet. Did you forget to add Reanimated Babel plugin in babel.config.js?
Chinwendu Evans
Chinwendu Evans

Posted on

Error: Failed to create a worklet. Did you forget to add Reanimated Babel plugin in babel.config.js?

If you are trying to implement a React Native Drawer Navigator and encounter the error 'Error: Failed to create a worklet. Did you forget to add Reanimated Babel plugin in babel.config.js?', here is a quick fix for Expo.

Error on Web:

Image of error on web

Error on Mobile

Image of error on mobile

Solution:

Step 1: Ensure That Reanimated Babel Plugin Is Added to babel.config.js

Note that in babel.config.js, the react-native-reanimated/plugin should be added, and it must be the last element in the array.

module.exports = function (api) {
  api.cache(true);
  return {
    presets: ["babel-preset-expo"],
    plugins: ["react-native-reanimated/plugin"],
  };
};
Enter fullscreen mode Exit fullscreen mode

Step 2:Restart Your Expo Server

Stop your Expo server (Ctrl+C), and then run the command below:

expo r -c

This will fix the issue. I hope it works for you. Feel free to comment and let me know if it worked for you. Thanks for reading. We can connect on X or LinkedIn.

Top comments (0)