0

Can't add reanimated package on react-native project, I am getting this error when i ran the app:

Error: While trying to resolve module react-native-reanimated from file /Users/.../app/index.android.js, the package /Users/...p/node_modules/react-native-reanimated/package.json was successfully found. However, this package itself specifies a main module field that could not be resolved (/Users/.../node_modules/react-native-reanimated/lib/Animated.js. Indeed, none of these files exist:

I am thinking of using babel-plugin-module-resolver to alias it and this is my babel.config.js but i am not sure if it will resolve 'react-native-reanimated' from other packages dependent to it:

module.exports = {
  env: {
    production: {
      plugins: ['transform-remove-console', 'react-native-reanimated/plugin'],
    },
  },
  presets: ['module:metro-react-native-babel-preset'],
  plugins: [
    [
      require.resolve('babel-plugin-module-resolver'),
      {
        root: ['.'],
        extensions: ['.android.js', '.ts', '.tsx', '.jsx', '.js'],
        alias: {
          'react-native-reanimated': 'react-native-reanimated/src/Animated',
        },
      },
    ],
    'react-native-reanimated/plugin',
  ],
};

but same error, help?

gpbaculio
  • 5,693
  • 13
  • 60
  • 102
  • you may find your answer here https://stackoverflow.com/questions/58131602/unable-to-resolve-module-react-native-reanimated – Nensi Kasundra Apr 11 '22 at 11:44
  • Have you looked at the installation guide and configured the native Android/iOS requirements: https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/installation/ – Aleksandar Zoric Apr 11 '22 at 12:54
  • Yes, i did both suggested on comments, i don't see the lib dir on my end – gpbaculio Apr 11 '22 at 13:10

0 Answers0