bcrypt使用エラー-No calback function was given

1102 ワード

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 aout trocing progress:
bcrypt.hash(user.password, salt, null, function (err, hash) { ... })
6 down vote
acceptedbcrypt.hash() requires 4 argments:
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 aout trocing progress:
bcrypt.hash(user.password, salt, null, function (err, hash) { ... })