software-mansion / react-native-reanimated

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

V2: Upgrade error `InnerNativeModule.installCoreFunctions` #846

Closed xignor closed 2 years ago

xignor commented 4 years ago

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

terrysahaidak commented 4 years ago

Hi. Did you run this with remote debugging enabled?

xignor commented 4 years ago

@terrysahaidak no, didn't had remote debugging enabled

terrysahaidak commented 4 years ago

What platform do you use?

xignor commented 4 years ago

@terrysahaidak ios with

Update babel.config.js, AppDelegate.h, AppDelegate.mm to reflect changes in https://docs.swmansion.com/react-native-reanimated/docs/installation

terrysahaidak commented 4 years ago

Ok, this is weird then. Could you try to clean build folder and rebuild your project from XCode?

xignor commented 4 years ago

@terrysahaidak tried cleared cached on react-native and clean build on XCode, and no avail

terrysahaidak commented 4 years ago

Then the only way to figure this out is to provide reproducing repo.

xignor commented 4 years ago

@terrysahaidak haven't had had a chance to create a reproducing repo but found that the issue is from adding

    _bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
    RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:_bridge

to a project using wix/react-native-navigation which uses multiple root views

piaskowyk commented 2 years ago

This issue should no longer appear. I am not able to reproduce on any stable version. If you still have this problem with the stable version please let me know.

samrith-s commented 2 years ago

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?

ericzhou27 commented 2 years ago

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?

77TecShaeer commented 2 years ago

+2

rdbsf commented 2 years ago

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

victorzimnikov commented 2 years ago

global.__reanimatedModuleProxy in undefined

juanjsebgarcia commented 2 years ago

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

shobhitsinghal624 commented 2 years ago

Started a new issue since this issue is marked as closed #2525

rafwell commented 2 years ago

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",
AHMAD19858 commented 2 years ago

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",

AHMAD19858 commented 2 years ago

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

samernady commented 2 years ago

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

princefishthrower commented 2 years ago

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 😄

victorzimnikov commented 2 years ago

"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

harrymash2006 commented 2 years ago

any updates regarding this issue ?

ajiehatajie commented 2 years ago

same issue

samrith-s commented 2 years ago

I have been stuck with this issue for 2 months with no resolution at all. I have a more detailed comment over at #2525. Any help would be highly appreciated!

hugo-chq commented 2 years ago

not sure if this helps, but I started getting this error when setting RNReanimated as static in podfile with this sort of change:

# this could cause the error
pre_install do |installer|
  installer.pod_targets.each do |pod|
    if pod.name.eql?('RNReanimated')
      def pod.build_type
        Pod::BuildType.static_library
      end
    end
  end
end

currently trying to get use_frameworks, react-native-screens and react-reanimated 2.3.0beta3 working together. No solution for that so far, but for others removing code that sets RNReanimated as static could help

EDIT: The solution for me was updating AppDelegate.m and AppDelegate.h based on react-native-upgrade-helper

https://github.com/software-mansion/react-native-reanimated/issues/2525#issuecomment-941122535

The issue was the forcereact (salesforce react-native) starter project didn't have more recent changes relating to RCTBridge in AppDelegate

hpardess commented 2 years ago

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.
DallAcqua commented 2 years ago

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.

Wellers0n commented 2 years ago

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'm with this error too

Wellers0n commented 2 years ago

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

dhamodar commented 2 years ago
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

kun-o commented 2 years ago
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

Thanks for this! This works for me, for both android and iOS. I've been stuck on this for quite a few days.

I am on: "react": "17.0.2", "react-native": "0.66.4", "react-native-reanimated": "2.3.1",

harry524483 commented 2 years ago

Fixed this issue by removing the changes made to AppDelegate.m file (https://github.com/facebook/react-native/issues/16376#issuecomment-891285914)

quando2311 commented 2 years ago

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

dhamodar commented 2 years ago

change version of react-native-reanimated to ^1.0.0

abdul-ahad-devs commented 2 years ago

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

Kazi-Yako commented 2 years ago

facebook/react-native#16376 (comment)

This works for me. Thank you!

I am on :

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;
  2. 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

munsifhayat commented 2 years ago

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

This solution is working fine for M1 as well.

nabarun1995 commented 2 years ago

This issue should no longer appear. I am not able to reproduce on any stable version. If you still have this problem with the stable version please let me know.

TypeError: Cannot read property 'installCoreFunctions' of undefined

i'm getiing this error

Stephen-L-Wang commented 2 years ago

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

works for me delete '^'

mrshahzeb7 commented 2 years ago
  target.build_configurations.each do |config|
    config.build_settings['OTHER_CPLUSPLUSFLAGS'] = '-DDONT_AUTOINSTALL_REANIMATED'
end

just replaced above code(copied from reanimated documentaion) with below one worked for me

      target.build_configurations.each do |config|
    config.build_settings['OTHER_CPLUSPLUSFLAGS'] = ''
end
kaialsh705 commented 2 years ago

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.

this work for me.

jdriverab commented 2 years ago

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

It worked too! at least with warns...

TYTY :)

piaskowyk commented 2 years ago

Same thread here: https://github.com/software-mansion/react-native-reanimated/issues/2525

Alavifuentes commented 2 years ago

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

mehrannmminaei commented 2 years ago

You must install according to these instructions Also, make no mistake

Add this code in MainApplication @Override protected JSIModulePackage getJSIModulePackage() { return new ReanimatedJSIModulePackage(); // <- add }

ybonnetain commented 2 years ago

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

yaronlevi commented 2 years ago

@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.

siddiquesheikh30 commented 2 years ago

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

hienbv1312 commented 2 years ago

@yaronlevi you saved my life. THANKS YOU