-
-
Notifications
You must be signed in to change notification settings - Fork 274
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
Error: Can't resolve 'crypto' in '\node_modules\bcryptjs\dist' #101
Comments
Seems that the library assumes a node environment, thus loading the |
@dcodeIO - Thank you for your prompt response. What do you suggest I do to resolve this? |
I've get same problem in react-native, because they not included "crypto" package. |
I get the same error in angular-cli 8.1.0. |
So, part of the problem here seems to be that the module attempts to require the crypto module first, expecting that it can catch the resulting error if this fails, but some environments do not allow catching the error but instead abort execution. That about correct? Maybe one way to deal with this is to invert the checks, first attempting WCA and only then attempting to require the crypto module. Whether this works or not depends on the availability of WCA of course, because if it isn't present, the same error will occur again when attempting the alternative. Someone here willing to try this by patching the library locally? Additionally, a better check could be added to only attempt requiring the crypto module when sufficiently sure that the code is running inside of a node environment, since without that, the fallback logic will never be able to run. |
I have tried to use bcryptjs in React native and get the same error. edit |
I've been using react-native-bcrypt instead. Works great. |
I'm having this issue in ember js. Any help please? |
Edit: set node to new value:
|
Any update on this? I am getting the same error. I am working with react-native. |
This happened to me when debugging my angular app with ...
"browser": {
"crypto": false
},
... Credits go to this SO answer |
Yes, that is exactly what happens. |
I have equal problem but i have not idea |
How to solve this issue/warning? |
I add this line in file package.json
"browser": {
"crypto": false
}
…On Mon, Apr 3, 2023 at 1:21 AM Rajan Chaudhary ***@***.***> wrote:
How to solve this issue/warning?
—
Reply to this email directly, view it on GitHub
<#101 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AUSZD6YGDC2T3E5PTH37H5LW7H3WJANCNFSM4HW36QNA>
.
You are receiving this because you commented.Message ID: <dcodeIO/bcrypt.
***@***.***>
|
I thought this is the same repo? |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in one week if no further activity occurs. Thank you for your contributions! |
Hi,
I am using bcryptjs (latest version of 2.4.3) in my app developed using Ionic framework.
I am getting the following come up:
[ng] WARNING in ./node_modules/bcryptjs/dist/bcrypt.js
[ng] Module not found: Error: Can't resolve 'crypto' in '\node_modules\bcryptjs\dist'
Any help will be much appreciated.
The text was updated successfully, but these errors were encountered: