As per the bcrypt npm documentation I tried to incorporate the package but unable to use bcrypt package in my app, so to test the bcrypt separately I created sample js file which is also crashing on execution without giving any error. Below is the js file which I tried to test. I tried to pass the constant value to hash function, which is also not working.
const bcrypt = require('bcrypt');
async function run(){
const saltValue =await bcrypt.genSalt(10);
bcrypt.hash('12345',saltValue)
.then(result => console.log(result))
.catch(error => console.log(error));
}
run();
Version: node : 9.0.0 npm: '5.5.1' "bcrypt": "^3.0.2",
With nodemon, I am getting message: app crashed - waiting for file changes before starting... in normal execution it is not showing any error.
Update:
If change the bcrypt's async methods with synchronous then it is working fine,
const saltValue = bcrypt.genSaltSync(10);
const hashed = bcrypt.hashSync('12345',saltValue);
I think someone from bcrypt team can answer.
Update: This issue raised on the community and few other developers are facing the same issue, for more information you can refer the link.