bcrypt使用报错-No callback function was given

使用bcrypt时遇到的报错

throw "No callback function was given".

No Callback function was given

bcrypt.hash()需要4个参数,

hash(data, salt, progress, cb)
The documentation is unclear on this: it states that  data salt  and  cb  are required, which implies that  progress  isn't, but without it you'll get the error.
Pass a  null  if you don't care about tracking progress:

bcrypt.hash(user.password, salt, null, function (err, hash) { ... })

6 down vote accepted

bcrypt.hash() requires 4 arguments:

hash(data, salt, progress, cb)

The documentation is unclear on this: it states that datasalt and cb are required, which implies that progress isn't, but without it you'll get the error.

Pass a null if you don't care about tracking progress:

bcrypt.hash(user.password, salt, null, function (err, hash) { ... })

你可能感兴趣的:(grunt)