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

Doesn't works with React Native (Expo) With Hermes #595

Closed
ScreamZ opened this issue Feb 20, 2023 · 7 comments
Closed

Doesn't works with React Native (Expo) With Hermes #595

ScreamZ opened this issue Feb 20, 2023 · 7 comments

Comments

@ScreamZ
Copy link

ScreamZ commented Feb 20, 2023

Hi,

Just wanted to share that the Client SDK no longer works with react native and expo.

Expo version : "expo": "~47.0.12",

 ERROR  ReferenceError: Property 'exports' doesn't exist, js engine: hermes
 ERROR  Invariant Violation: Failed to call into JavaScript module method AppRegistry.runApplication(). Module has not been registered as callable. Registered callable JavaScript modules (n = 11): Systrace, JSTimers, HeapCapture, SamplingProfiler, RCTLog, RCTDeviceEventEmitter, RCTNativeAppEventEmitter, GlobalPerformanceLogger, JSDevSupportModule, HMRClient, RCTEventEmitter.
        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
 ERROR  Invariant Violation: Failed to call into JavaScript module method AppRegistry.runApplication(). Module has not been registered as callable. Registered callable JavaScript modules (n = 11): Systrace, JSTimers, HeapCapture, SamplingProfiler, RCTLog, RCTDeviceEventEmitter, RCTNativeAppEventEmitter, GlobalPerformanceLogger, JSDevSupportModule, HMRClient, RCTEventEmitter.
        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
@jaime-ez
Copy link
Collaborator

Hi, I'll try to take a look, can you share a message that references deepstream explicitly? That error doesn't...

@ScreamZ
Copy link
Author

ScreamZ commented Feb 21, 2023

It doesn't, just try to import the SDK (installed with the REACT_NATIVE env var) somewhere and you end up with this… :'(

@jaime-ez
Copy link
Collaborator

jaime-ez commented Feb 21, 2023

Ok, found a few bugs, solved in lateste release v7.0.1

These are my steps using expo:

npx create-expo-app my-app --template bare-minimum
cd my-app
DEEPSTREAM_ENV=react-native npm install @deepstream/client
npx expo start

it works as expected

@jaime-ez
Copy link
Collaborator

Please reopen with detailed steps to reproduce if the problem persists

@ScreamZ
Copy link
Author

ScreamZ commented Feb 21, 2023

Looks like it's not working in my project still, I'll check deeper but we have an issue I guess.

About the installation on React Native

Also, I've some concerns about the technique of doing the install using an env variable. As far as I can see, this will run a post-install script that changes code in the node_modules.

With this technique this work on the computer that initially did the installation. But coworkers that pull your changes on git just end up with the "standard" version.

I guess it would be better to add some checks in the code to check whether or not we are in react native environment.

See facebook/react-native@3c65e62

@jaime-ez what do you think ?

PS : I'll give detailed reproduction soon

@jaime-ez
Copy link
Collaborator

jaime-ez commented Mar 10, 2023

Hi, take a look at the original issue #534 for some background.

An option you can take is that in your own project's package.json add a postinstall script:

{
  "scripts" : {
     "postinstall": "DEEPSTREAM_ENV=react-native node node_modules/@deepstream/client/scripts/postinstall.js"
  }
}

That way anyone who clones your repo will have the desired version

@jaime-ez jaime-ez reopened this Mar 10, 2023
@jaime-ez
Copy link
Collaborator

closing due to inactivity, please provide more information if the problem persists

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants