Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[3.2.1] Unable to resolve module crypto from node_modules/crypto-js/core.js: crypto could not be found within the project. #260

Closed
Bardiamist opened this issue Feb 12, 2020 · 15 comments

Comments

@Bardiamist
Copy link

I got

Unable to resolve module `crypto` from `node_modules/crypto-js/core.js`: crypto could not be found within the project.

when updated from 3.2.0 to 3.2.1

@kishansbs
Copy link

same issue

@Malikkhoja-zz
Copy link

Same issue. We are using react-native-pdf and it has crypto-js as the dependency.

@evanvosberg
Copy link
Member

Duplicate of #256

Please help to verify whether this pull request #259 would solve it.

@Bardiamist
Copy link
Author

@evanvosberg

I added in package.json:

"crypto-js": "git+https://github.com/brix/crypto-js.git#feature/react-native",

Then I tried to run project and got next red screen:

Unable to resolve module `crypto-js/hmac-sha512` from `src/global/api.ts`: crypto-js/hmac-sha512 could not be found within the project.

If you are sure the module exists, try these steps:
 1. Clear watchman watches: watchman watch-del-all
 2. Delete node_modules: rm -rf node_modules and run yarn install
 3. Reset Metro's cache: yarn start --reset-cache
 4. Remove the cache: rm -rf /tmp/metro-*

RCTFatal
__28-[RCTCxxBridge handleError:]_block_invoke
_dispatch_call_block_and_release
_dispatch_client_callout
_dispatch_main_queue_callback_4CF
__CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__
__CFRunLoopRun
CFRunLoopRunSpecific
GSEventRunModal
UIApplicationMain
main
start

I have

import hmacSHA512 from 'crypto-js/hmac-sha512';

in src/global/api.ts

@evanvosberg
Copy link
Member

@Bardiamist did you run grunt build on this branch and then used the content of the build directory only?

The structure of the develop branch is not designed to be used directly. It's required to run grunt build in order to create a running package in the build directory.

@Bardiamist I would appreciate when you comment directly on the pull request, not here.

@gHashTag
Copy link

I do not use crypto, but I also use AWS Amplify with react-native. I get this error. How to fix?

@evanvosberg
Copy link
Member

This issue is marked as DUPLICATE

Please leave your comments here

@imwilliamxy
Copy link

Same issue when upgrade from 3.1.9-1 to 4.0.0 used in react native project.

@hanykumar
Copy link

same issue with "crypto-js": "^4.0.0"

Screenshot 2020-10-01 at 4 32 08 PM

@Bardiamist
Copy link
Author

Continued discussion here: #259

@developeromI89
Copy link

facing same issue. using Azure-blob-storage with React-Native

crypto could not be found within the project or in these directories:
node_modules

If you are sure the module exists, try these steps:

  1. Clear watchman watches: watchman watch-del-all
  2. Delete node_modules and run yarn install
  3. Reset Metro's cache: yarn start --reset-cache
  4. Remove the cache: rm -rf /tmp/metro-*
    9 | var abortController = require('@azure/abort-controller');
    10 | var os = require('os');

11 | var crypto = require('crypto');
| ^
12 | var coreTracing = require('@azure/core-tracing');
13 | var stream = require('stream');
14 | require('@azure/core-paging');]
Error: Unable to resolve module crypto from azure\MyApp\node_modules@azure\storage-blob\dist\index.js: crypto could not
be found within the project or in these directories:
node_modules

@bluego78
Copy link

same issue here

@Bardiamist
Copy link
Author

#259 (comment)

@xujintai123
Copy link

xujintai123 commented May 9, 2023

when i updated "crypto-js" from '3.2.1' to "3.3.0", solved

@aaronNGJ5
Copy link

I found that react-native-crypto don't work on recent which using react-native version 0.62.2 and react version 16.11.0, any more.

I used crypto-js package. The version is 4.2.0 in my react-native app. It's working well on my side.
You can add this in package.json, to try.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests