software-mansion / react-native-reanimated

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

App started crashing with the errors mentioned on description #2361

Closed tusharkhatiwada closed 2 years ago

tusharkhatiwada commented 3 years ago

Description

App was working perfectly fine earlier. The next day when I tried to run the project, I started getting the following errors:

Error: If you want to use Reanimated 2 then go through our installation steps https://docs.swmansion.com/react-native-reanimated/docs/installation, js engine: hermes

Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication). A frequent cause of the error is that the application entry file path is incorrect. This can also happen when the JS bundle is corrupt or there is an early initialization error when loading React Native., js engine: hermes

I tried to reinstall the package but still getting these errors. I followed the documentation for installation.

If I remove the imports from react-native-reanimated, the app works.

Expected behavior

The app should run without the above errors.

Snack or minimal code example

babel.config.js

module.exports = {
  presets: ['module:metro-react-native-babel-preset'],
  plugins: [
    [
      'module-resolver',
      {
        root: ['.'],
        extensions: [
          '.ios.ts',
          '.android.ts',
          '.ts',
          '.ios.tsx',
          '.android.tsx',
          '.tsx',
          '.jsx',
          '.js',
          '.json',
        ],
        alias: {
          '@screens': './src/screens',
          '@constants': './src/constants',
          '@components': './src/components',
          '@images': './src/assets/images',
          '@api': './src/api',
        },
      },
    ],
    'react-native-reanimated/plugin',
  ],
};

Podfile

use_react_native!(
    :path => config[:reactNativePath],
    # to enable hermes on iOS, change `false` to `true` and then install pods
    :hermes_enabled => true
  )

Package versions

Affected platforms

github-actions[bot] commented 3 years ago

Issue validator

The issue is invalid!

rvasseur31 commented 3 years ago

I am using yarn

try to execute this command : watchman watch-del-all && rm -rf $TMPDIR/react-native-packager-cache- && rm -rf $TMPDIR/metro-bundler-cache- && rm -rf node_modules/ && yarn cache clean && yarn install && yarn start -- --reset-cache

tusharkhatiwada commented 3 years ago

@rvasseur31 Not working. Cleared the cache and still the same problem

wendan52 commented 3 years ago

@rvasseur31 Not working. Cleared the cache and still the same problem

have you fix this problem?

mysport12 commented 3 years ago

Try running yarn upgrade and see if that helps.

BECkvalentine commented 3 years ago

I was running into a similar issue as well and what fixed it for me was removing module:metro-react-native-babel-preset

I am using expo so I am using the babel-preset-expo preset. Below is how my babel config is

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

Not sure why that fixed things for me but maybe it might help someone else running into this issue

jkadamczyk commented 2 years ago

Hi @tusharkhatiwada

I had a very similar issue myself and it was something with the Babel preset. I can't help you directly since I don't remember how I fixed it because it was a long time ago.

What I would suggest if you would like us to help you is, try stripping everything from the app you are working on so that you are not leaking any sensitive info and any code that you can't show us and making it so that you leave the configuration, so that we can reproduce the configuration issue you have.

If you managed to fix the issue please, share with others what was helpful for you.

Until then I will close the issue, thank you for reporting and have a good day 😊