I'm working on a React Native project
and I need to implement authentication, with an encrypted password.
I want to use library Bcrypt
but I have an issue. Bcrypt
requires the Crypto module
, which was a third-part library, but now it is a built-in module in Node.js
.
When I try to use Bcrypt with const bcrypt = require('bcrypt')
, it throws an error :
Unable to resolve module 'crypto' from 'node_modules/bcrypt/...'
I am using :
- Node.js v13.0.1
- NPM v6.12.0
- react-native-cli v2.0.1
- react-native v0.61.3
- react v16.9.0
To manage this error, I went to Node.js
documentation and tried the solution to know if the Crypto
built-in module is available or not but it throws the same error.
Maybe I don't understand clearly what is a built-in module, is that a module which is included into the Node.js installer, so I don't have any NPM install crypto to do?
If it is the case, does anyone have an idea about why I can't use it in my project?
I also tried the rn-nodeify module
, with react-native-bcrypt
and react-native-crypto
, but in each case some packages weren't reached, like stream
, VM
, fs
, etc.
Do you encountered the same problem and solved it?