react-native-reanimated: V2: Upgrade error `InnerNativeModule.installCoreFunctions`

Description

When running the app after 1.8 to 2 upgrade Reanimated throws this error:

Error: Requiring module "node_modules/react-native-reanimated/src/reanimated2/index.js", which threw an exception: TypeError: null is not an object (evaluating 'InnerNativeModule.installCoreFunctions')

Screenshots

image

Steps To Reproduce

  1. Upgrade from1.8.0 to 2.0.0-alpha.1
  2. Update babel.config.js, AppDelegate.h, AppDelegate.mm to reflect changes in https://docs.swmansion.com/react-native-reanimated/docs/installation

Package versions

  • React: 16.11.0
  • React Native: 0.62.2
  • React Native Reanimated: 2.0.0-alpha.1

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 2
  • Comments: 59 (6 by maintainers)

Most upvoted comments

was facing same problem “react-native”: “0.66.0”, “react-native-reanimated”: “^2.3.0-beta.2”,

I changed in android/app/build.gradle project.ext.react = [ enableHermes: true ]

and in the MainApplication.java I added on top import com.facebook.react.bridge.JSIModulePackage; import com.swmansion.reanimated.ReanimatedJSIModulePackage; and in the function ReactNative Host () I added @Override protected JSIModulePackage getJSIModulePackage() { return new ReanimatedJSIModulePackage(); }

It worked like a charm

change version of react-native-reanimated to ^1.0.0

For wanderers having this issue on iOS (or very similar, something about the JSI module not having the VM reference early on)… Make sure to init RCTRootView using the appropriate initializer with the help of RCTBridgeDelegate

RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self
                                          launchOptions:launchOptions];

RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge
                                                 moduleName:@"MyApp"
                                          initialProperties:initialProps];

Not initWithBundleURL

i have the same issue Cannot read property ‘installCoreFunctions’ of undefined, js engine: hermes

“react-native”: “0.66.0”, “react-native-reanimated”: “^2.3.0-beta.2”,

it worked with me after adding plugins: [ ‘react-native-reanimated/plugin’, ] in babel.config.js after that npm start --reset-cache

hope it will work with u guys

Have this exact same issue with reanimated@v2.3.0-beta.1 when trying to run the app. No idea what to do or fix, cannot create a reproduction repo as our project is extremely complicated. Can you point how to debug this? Where is it trying to find installCoreFunctions? Which file is calling it?

“react-native”: “0.66.0”, “react-native-reanimated”: “^2.3.0-beta.2”,

:hermes_enabled => true

npm start --reset-cache

android works fine. ios error: TypeError: Cannot read property ‘installCoreFunctions’ of undefined, js engine: hermes

Note for all arriving here as they upgrade to React Native 0.66.0. You need to implement BOTH comments from @AHMAD19858 and @samernady to get it to work - but the docs link that @rafwell posted has both 😄

@ybonnetain your comment saved me days of work! I’ve tried everything but nothing helped.

Becuase we use Codepush we had this line:

let rootView = RCTRootView(bundleURL:jsCodeLocation!, moduleName: "rumble_mobile", initialProperties: nil, launchOptions:launchOptions)

But after changing it to:

let rctBridge = RCTBridge(delegate: self, launchOptions: launchOptions)    
let rootView = RCTRootView(bridge: rctBridge!, moduleName: "rumble_mobile", initialProperties: nil)

The installCodeFunctions error disappered.

I think many people that use CodePush had the same problem. Probably when integrating Codepush you accidentally remove the RCTBridge line and use the other variation of the constructor RCTRootView.

I think this should be added to the docs, just in case.

post_install do |installer|
   installer.pods_project.targets.each do |target|
       target.build_configurations.each do |config|
           config.build_settings['OTHER_CPLUSPLUSFLAGS'] = ''
       end
   end
end

** solution for ios add above code piece on podFile **

i changed version of react-native-reanimated to 2.2.4 and it worked

I’m getting the same issue as @samrith-s but with reanimated@v2.3.0-beta.2, the only version that works with RN 0.66. Any ideas for fixes?

facebook/react-native#16376 (comment)

This works for me. Thank you!

I am on :

  • react-native": “0.66.4”,
  • react: “17.0.2”,
  • “react-native-reanimated”: “^2.3.0-beta.2”,

I changed in android/app/build.gradle: project.ext.react = [ enableHermes: true ]

In the MainApplication.java:

  1. I added on top:
  • import com.facebook.react.bridge.JSIModulePackage;
  • import com.swmansion.reanimated.ReanimatedJSIModulePackage;
  1. In the function ReactNative Host (), I added: @Override protected JSIModulePackage getJSIModulePackage() { return new ReanimatedJSIModulePackage(); }

I deleted the node modules (rm -rf node_modules)

I ran yarn start --reset-cache

I ran “Yarn”

cd ios and ran Pod install

yarn run android

Hi guys. I’ve found this issue when I upgrade from RN 0.65 to 0.66. I fixed folowing the installation instructions here https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/installation/

Well, I don’t know why this was working before, but in my project was missing some steps, like enableHermes:true and some overrides.

Now is working like a charm.

"react-native": "0.66.0",
"react-native-reanimated": "^2.3.0-beta.2",

+1 also with “react-native-reanimated”: “2.3.0-beta.2”,

was facing same problem “react-native”: “0.66.0”, “react-native-reanimated”: “^2.3.0-beta.2”,

I changed in android/app/build.gradle project.ext.react = [ enableHermes: true ]

and in the MainApplication.java I added on top import com.facebook.react.bridge.JSIModulePackage; import com.swmansion.reanimated.ReanimatedJSIModulePackage; and in the function ReactNative Host () I added @Override protected JSIModulePackage getJSIModulePackage() { return new ReanimatedJSIModulePackage(); }

It worked like a charm

it works for me

Can we have this issue reopened @jmysliv @piaskowyk? Keeping it closed keeps it buried and it looks like its causing some trouble for RN 0.66

Can anyone kindly tell me what and why is it undefined in this latest update?

Configuraciones de la documentacion resuelve el problema “react”: “17.0.2”, “react-native”: “0.67.2”, “react-native-gesture-handler”: “^2.2.0”, “react-native-reanimated”: “^2.4.1”, https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/installation/ image

I have followed the guide of this comment https://github.com/software-mansion/react-native-reanimated/issues/846#issuecomment-943267584 and now it is giving me an error as this - “Error: Reanimated 2 failed to create a worklet, maybe you forgot to add Reanimated’s babel plugin?, js engine: hermes” also this “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 am using react-native 0.67 please help

i changed version of react-native-reanimated to 2.2.4 and it worked

works for me delete ‘^’

I am experiencing similar issue and here is my dependencies: “react”: “17.0.2”, “react-native”: “0.66.4”, “react-native-reanimated”: “^2.3.0”,

 BUNDLE  ./index.js

 ERROR  TypeError: undefined is not an object (evaluating 'InnerNativeModule.installCoreFunctions')
 ERROR  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.
 ERROR  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.

I am experiencing similar issue and here is my dependencies: “react”: “17.0.2”, “react-native”: “0.66.4”, “react-native-reanimated”: “^2.3.0”,

 BUNDLE  ./index.js

 ERROR  TypeError: undefined is not an object (evaluating 'InnerNativeModule.installCoreFunctions')
 ERROR  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.
 ERROR  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.

@hpardess I downgraded my reanimated version specifically to “react-native-reanimated”: “2.1.0” without the “^” operator, and it worked. I think other versions up to 2.3.0 works too.

For wanderers having this issue on iOS (or very similar, something about the JSI module not having the VM reference early on)… Make sure to init RCTRootView using the appropriate initializer with the help of RCTBridgeDelegate

RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self
                                          launchOptions:launchOptions];

RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge
                                                 moduleName:@"MyApp"
                                          initialProperties:initialProps];

Not initWithBundleURL

This gives this error Use of undeclared identifier 'initialProps'

i have the same issue Cannot read property ‘installCoreFunctions’ of undefined, js engine: hermes

“react-native”: “0.66.0”, “react-native-reanimated”: “^2.3.0-beta.2”,