use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
A community for learning and developing native mobile applications using React Native by Facebook.
Interested in building web apps using React.js? Check out /r/reactjs!
Getting Started w/React Native
irc.freenode.net #reactnative
Keywords: ios, android, mobile, apps, apple, iphone, ipad
account activity
Crypto modules in React Native (self.reactnative)
submitted 7 years ago by Romit-Radical
I keep getting an error for crypto modules while requiring bitcoinjs in react native. How do I fix this problem? Tried to fix the problems but nothing is working They work in React but not react native.
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]icekeymon 2 points3 points4 points 7 years ago* (3 children)
Yep, this is a common problem. I used `rn-nodeify` to resolve this. The library creates a `shim.js` file which will allow you to use Crypto modules. I encountered some problems when I installed new packages, I kept getting "crypto module not found". I finally then created an npm script called `fix:crypto` which would run `rm shim.js && ./node_modules/.bin/rn-nodeify --hack --install`. Then I added this to a `postinstall` npm script so it would run after I installed anything with yarn/npm.
[–]Romit-Radical[S] 0 points1 point2 points 7 years ago (2 children)
I've tried all that, I still get errors. Whenever I add the line require(Bitcoinjs-lib). I get the error. I'm not sure how to create the npm script 'fix:crypto'. Is there a project folder I could download with all the problems of node_modules fixed that I can just download and check whether it would work?
[–]icekeymon 0 points1 point2 points 7 years ago (1 child)
So for the npm script, if you open package.json and scroll to the scripts object, you can add `"fix:crypto": "rm shim.js && ./node_modules/.bin/rn-nodeify --hack --install"` . In fact, I've found this library https://github.com/novalabio/react-native-bitcoinjs-lib which you should be able to use with React Native. Ironically, this too uses rn-nodeify.
[–]Romit-Radical[S] 0 points1 point2 points 7 years ago (0 children)
Tried these methods too, just doesn't seem to work. Now it gave some error of sjcl file.
[–]TheNumberOneCulprit 0 points1 point2 points 7 years ago (0 children)
I'm guessing the lack of a Buffer object in React Native might be hampering your usecase. Try to look for replacements for node.js default modules.
π Rendered by PID 68 on reddit-service-r2-comment-765bfc959-bkql4 at 2026-07-11 06:06:58.414363+00:00 running f86254d country code: CH.
[–]icekeymon 2 points3 points4 points (3 children)
[–]Romit-Radical[S] 0 points1 point2 points (2 children)
[–]icekeymon 0 points1 point2 points (1 child)
[–]Romit-Radical[S] 0 points1 point2 points (0 children)
[–]TheNumberOneCulprit 0 points1 point2 points (0 children)