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

Compatibility: node packages depending on V8 can't function in react-native iOS #5881

Closed
ambarc opened this issue Feb 11, 2016 · 5 comments
Closed
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@ambarc
Copy link

ambarc commented Feb 11, 2016

I'm building a react-native app to go across Android and iOS. I'm noticing some dependencies in libraries I'm using depend on having a V8 (node) runtime. This breaks the JavaScriptCore JS runtime on iOS, with RN error-ing with something like:

Requiring unknown module _moduleA_. If you are sure the module is there try restarting the packager.

What I'm noticing is that v8 requiring moduleA doesn't get copied over in the react bundle that gets placed on the phone. I found this by logging the modules present in

node_modules/react-native/packager/react-packager/src/Resolver/polyfills/require.js

Since I don't own the libraries that I'm trying to use I can't modify the dependency.

In my case I'm trying to use the twilio module which uses Node's crypto module.

I'm guessing I won't face this issue when I build RN on Android.

What are the options like?

@facebook-github-bot
Copy link
Contributor

Hey ambarc, thanks for reporting this issue!

React Native, as you've probably heard, is getting really popular and truth is we're getting a bit overwhelmed by the activity surrounding it. There are just too many issues for us to manage properly.

  • If you don't know how to do something or something is not working as you expect but not sure it's a bug, please ask on StackOverflow with the tag react-native or for more real time interactions, ask on Discord in the #react-native channel.
  • If this is a feature request or a bug that you would like to be fixed, please report it on Product Pains. It has a ranking feature that lets us focus on the most important issues the community is experiencing.
  • We welcome clear issues and PRs that are ready for in-depth discussion. Please provide screenshots where appropriate and always mention the version of React Native you're using. Thank you for your contributions!

@grabbou
Copy link
Contributor

grabbou commented Apr 20, 2016

I would't say this is possible, just like it's not possible to use node modules in Chrome or Firefox.

You can check this out, but I don't think it's going to be production ready: https://github.com/mvayngrib/rn-nodeify

@ide
Copy link
Contributor

ide commented Apr 20, 2016

just like it's not possible to use node modules in Chrome or Firefox

For emphasis: just as Node and the browser are different environments that happen to use the same language, React Native is a third JS environment that's not a browser and isn't Node. Packages need to be written to either be universal or specifically written for React Native.

There's the "react-native" key in package.json for aliasing modules but fundamentally packages made for Node aren't necessarily going to work with RN.

@lacker
Copy link
Contributor

lacker commented Oct 20, 2016

In practice, I suggest bugging Twilio to make their stuff work with React Native. I'm closing this issue because I believe it has only the potential for philosophical angst at this point. Good luck!

@lacker lacker closed this as completed Oct 20, 2016
@aschrijver
Copy link

There's the option to run V8 on android with node built-in. Haven't tried yet, but I will.

@facebook facebook locked as resolved and limited conversation to collaborators Jul 20, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 20, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

7 participants