Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: Cannot read property 'NativeModule' of undefined, js engine: hermes #8316

Open
Leli1024 opened this issue Jun 29, 2024 · 13 comments
Assignees
Labels
comp:react-native type:bug Something isn't working

Comments

@Leli1024
Copy link

Im using the latest versions of react native and the tfjs package. But when ai try to import bundleIOResources specifically. I get the error TypeError: Cannot read property 'NativeModule' of undefined, js engine: hermes

My project does not use expo, it is not an expo managed app

@Leli1024 Leli1024 added the type:bug Something isn't working label Jun 29, 2024
@paradite
Copy link
Contributor

paradite commented Jun 30, 2024

Taking a look at the code (I worked on it before), it seems to require some other libraries like expo-asset to work: https://github.com/tensorflow/tfjs/blob/master/tfjs-react-native/src/bundle_resource_io.ts

If you are not using expo, you might not have those libraries then it won't work. I think if you install expo-asset manually it should work.

You can also take what you need from tfjs-react-native/src/platform_react_native.ts into your own repo and then add whatever storage you need manually:

@gaikwadrahul8 gaikwadrahul8 self-assigned this Jul 2, 2024
@gaikwadrahul8
Copy link
Contributor

Hi, @Leli1024

I apologize for the delay in my response. Have you had a chance to try the workaround mentioned by @paradite in the previous comment? If so, please let me know if the issue has been resolved or if you are still encountering problems.

Thank you for your cooperation and patience.

@Leli1024
Copy link
Author

Leli1024 commented Jul 5, 2024

Thanks both, I tried the workaround on my bare project and it did not work, but when I coded a dummy app using expo, it did so I'm assuming it is not working because these dependencies just don't work with react native bare projects.

Another thing to note is that when trying to run predictions on images, the app crashes

@Usama-Nazir
Copy link

i am facing ERROR in react native project and I am unable to solve to these errors anyone can share the solution of these errors
TypeError: Cannot read property 'NativeModule' of undefined, js engine: hermes
LOG Running "AwesomeProject" with {"rootTag":171}
ERROR Invariant Violation: "AwesomeProject" has not been registered. This can happen if:

  • Metro (the local dev server) is run from the wrong folder. Check if Metro is running, stop it and restart it in the current project.
  • A module failed to load due to an error and AppRegistry.registerComponent wasn't called., js engine: hermes
image

@Adelkunagi
Copy link

Adelkunagi commented Sep 3, 2024

J'ai exactement le même problème, si on peut m'aider (nous aider), c'est génial.
As-tu corrigé le problème ? Si oui, comment stp ?

@BerkYxvuz
Copy link

I have same issue, i installed expo-av in my project and i get it this error.
image

@brunopintos
Copy link

@Usama-Nazir Same issue here. Where you able to solve it?

@TomGroombridge
Copy link

anymore progress here? same issue for me

@Gugarauj07
Copy link

Same issue here.

@paradite
Copy link
Contributor

paradite commented Sep 23, 2024

Hi everyone, I haven't used this library recently, but this error is usually a sign that your native modules are not loaded.

This could happen if you use expo go, and it's missing a required native module. Expo team decides which modules are included in expo go, so it could be that they removed a module required by tfjs in expo go.

In any case, you should use expo dev client for development and testing, in which you can control which native modules are installed.

Hope this helps.

@Kotchanit
Copy link

Same issue here.

@dimisus
Copy link

dimisus commented Sep 25, 2024

This issue is not related to tensorflow it seems, but to expo - I think. But I also couldn't detect where it specifically comes from in my case.

Related to:
expo/expo#29568
expo/expo#31018

@leeminwuk
Copy link

The same error occurs when using Expo assets.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp:react-native type:bug Something isn't working
Projects
None yet
Development

No branches or pull requests