tradle / react-native-crypto

partial implementation of node's `crypto` for react-native
MIT License
371 stars 84 forks source link

Object prototype may only be an Object or null #2

Closed huutrancl closed 7 years ago

huutrancl commented 8 years ago

I tried all the solutions suggested at https://github.com/mvayngrib/react-native-randombytes/issues/5 I did (react native > 0.29.0)

  1. npm i --save-dev rn-nodeify
  2. rn-nodeify --install --hack
  3. linked to react-native-randombytes

Now I can not import react-native-crypto. screen shot 2016-09-12 at 14 24 50

mvayngrib commented 8 years ago

check out https://github.com/mvayngrib/rn-nodeify/issues/18

liuzhen2008 commented 8 years ago

@mvayngrib As far as I understand, that "hack" has already been pushed to NPM?

I just npm install rn-nodeify and I can see that locally https://github.com/mvayngrib/rn-nodeify/commit/9917779ed9a461c6c43ba410b9f0bf6372c6f31a is already there.

Yet when I ran it on android in windows I still run into this issue? I mainly needed this so a dependency of my app does not break on me when it does require("crypto")

I am using react-native 0.32.1

For me, i only installed crypto, streams, events. because apparently crypto uses the other two.

mvayngrib commented 8 years ago

@liuzhen2008 just to make sure, does that dep really need the crypto module? If not, you may be able to just exclude crypto: https://github.com/facebook/react-native/commit/5710b230a2a0f2b29553fbf94af5147a2e030f44

mvayngrib commented 8 years ago

@liuzhen2008 released rn-nodeify@7.0.1 with fix for windows by @mhofman: https://github.com/mvayngrib/rn-nodeify/commit/67642d26c08440a117971396c6a4ee3dc1c524b7

liuzhen2008 commented 8 years ago

@mvayngrib Thanks. I will update rn-nodeify once i get home.

But to answer your first question. My react native application uses a "sockjs-node" module. And that module doesrequires("crypto") at some point in its code.

Apparently I didn't need to use rn-nodeify on a Mac. Really odd.

liuzhen2008 commented 8 years ago

@mvayngrib Just tested. The same error still occurs. same stack as @huutrancl posted

mvayngrib commented 8 years ago

@liuzhen2008 hm, i've never tested on windows (are you using windows now?). Usually when errors persist it means i need to rerun the rn-nodeify script. For example after you npm i <something>, you should re-run rn-nodeify. Hope it helps...

baobabKoodaa commented 7 years ago

I'm also stuck at this error on Windows.

yreenchan commented 7 years ago

So I wonder how can I solve this error ? I occur this error now...

omidnavy commented 7 years ago

no answer for this issue ? i have this problem with react-native-tcp and react-native-crypto ! is there any solution ?

yreenchan commented 7 years ago

@omidnavi I have solved this problem, you can try to do this. npm install readable-stream@latest stream-browserify@latest --save

omidnavy commented 7 years ago

@yreenchan Thanks for your response , could you please give me a complete walkthrough ?

omidnavy commented 7 years ago

@yreenchan Oh its not needed 👍 Everything is working now , Thank you , you made my day.

yreenchan commented 7 years ago

@omidnavi You're welcome !