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

Unable to resolve module 'crypto' #123

Open
rhrahul opened this issue Dec 13, 2018 · 1 comment
Open

Unable to resolve module 'crypto' #123

rhrahul opened this issue Dec 13, 2018 · 1 comment

Comments

@rhrahul
Copy link

rhrahul commented Dec 13, 2018

Hey,

I am facing this issue,

error: bundling failed: Error: Unable to resolve module "crypto" from "..\myProject\node_modules\speakeasy\index.js": Module "crypto" does not exist in the Haste module map

I am using React Native v0.57.7

Any Suggestions Please ?

@NishidaRyu416
Copy link

NishidaRyu416 commented Mar 12, 2019

According to an item on stackoverflow.

The crypto module is a built-in Node module; React Native runs JS on JavaScriptCore (when on the device or simulator) and on Chrome itself (when using Chrome debugging), so modules that depend on built-in Node.js modules cannot work. See the JavaScript Runtime section of the React Native docs for more info.

There are two solutions.

  1. The solution you can do only using crypto is to use browserify.

https://hackernoon.com/using-core-node-js-modules-in-react-native-apps-64acd4d07140

But as you’ll see, this is not straightforward.

  1. You can have a two factor authentication api on a server built in nodejs, that way, you will be able to use crypto module easily.

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