EdgeApp / edge-core-js

Edge Core Javascript implementation. Provides Edge account and wallet functionality for NodeJS/HTML/React Native apps
https://edge.app
Other
72 stars 49 forks source link

Unable to resolve module `crypto` #47

Closed lacvapps closed 6 years ago

lacvapps commented 6 years ago

On a fresh edge-login install to react native, when I run react-native run-ios it will build successfully but when attempting to use the app it gives me the error.

bundling failed: UnableToResolveError: Unable to resolve module crypto from ../node_modules/edge-login/lib/edge-core-index.js: Module does not exist in the module map

lacvapps commented 6 years ago

This is what the nom package crypto says in the readme

Deprecated Package

This package is no longer supported and has been deprecated. To avoid malicious use, npm is hanging on to the package name.

It's now a built-in Node module. If you've depended on crypto, you should switch to the one that's built-in.

Please contact support@npmjs.com if you have questions about this package.

lacvapps commented 6 years ago

Was able to get past this error by following https://github.com/tradle/react-native-crypto

swansontec commented 6 years ago

Aha, I see the problem. Our edge-login package needs to be hacked using rn-nodeify --hack. I'm not sure how that crypto dependency snuck its way in there, but using rn-nodeify successfully eliminates the problem (https://github.com/tradle/rn-nodeify). I think the proper solution is to fix the edge-login library to not require crypto on React Native, since we don't use it internally anywhere.

swansontec commented 6 years ago

I have created an issue in our internal bug tracker to get this resolved.

lacvapps commented 6 years ago

Okay sounds good, thank you for the fast reply!

swansontec commented 6 years ago

This should be fixed in v0.5.6. The library works on React Native without using rn-nodeify.

lacvapps commented 6 years ago

Awesome thank you