When i try to compile my react-native app with the 4.5 release ( which has the following
"dependencies": {
"crypto-js": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/crypto-js/-/crypto-js-4.0.0.tgz",
"integrity": "sha512-bzHZN8Pn+gS7DQA6n+iUmBfl0hO5DJq++QP3U6uTucDtk/0iGpXd/Gg7CGR0p8tJhofJyaKoWBuJI4eAO00BBg=="
} )
I get the following error on startup:
error: Error: Unable to resolve module crypto
from node_modules/crypto-js/core.js
: crypto could not be found within the project.
If you are sure the module exists, try these steps:
- Clear watchman watches: watchman watch-del-all
- Delete node_modules: rm -rf node_modules and run yarn install
- Reset Metro's cache: yarn start --reset-cache
- Remove the cache: rm -rf /tmp/metro-*
I've done all the steps recommended but continue to get the same error. From some general research on google, it appears that the last stable version of this package to work well with RN was version 3.3.0.
Using a bare RN project, I also encountered this issue. As a workaround, I tried using different release versions of crypto-js was able to make it work. I find myself resolving to lower version v3.3.0.
Version Error
v4.0.0 error: Error: Unable to resolve module crypto from node_modules/crypto-js/core.js: crypto could not be found within the project.
v3.3.0
v3.2.0 Error: Native crypto module could not be used to get secure random number.
It seems like this isn't an RN issue but is more of the crypto-js dependency issue.
Is there anything I can do with the braincloud npm module to get around this issue? Totally stuck right now
Thanks,
Greg