Search code examples
react-nativespeakeasy

error when trying to use speakeasy from a react-native project


error: bundling failed: "Unable to resolve module crypto from myproject/node_modules/speakeasy/index.js: Module does not exist in the module map\n\nThis might be related to https://github.com/facebook/react-native/issues/4968\nTo resolve try the following:\n 1. Clear watchman watches: watchman watch-del-all.\n 2. Delete the node_modules folder: rm -rf node_modules && npm install.\n 3. Reset packager cache: rm -fr $TMPDIR/react-* or npm start -- --reset-cache."

Following the suggested steps doesn't seem to do any good.

Also tried to yarn add react-native-crypto but that didn't help either.


Solution

  • I was using rn-nodeify but limiting it to specific modules.

    As described https://www.npmjs.com/package/rn-nodeify, one can run rn-nodeify --install --hack and int takes care of the crypto lib among others.