Cannot install bcrypt node.js module on Centos Server

后端 未结 4 1205
栀梦
栀梦 2020-12-03 15:49

I\'m trying to install bcrypt on CentOS server but I got the following error:

info postuninstall bcrypt@0.5.0
ERR! bcrypt@0.5.0 install: `make build`
ERR! `s         


        
4条回答
  •  心在旅途
    2020-12-03 16:17

    There is also a native-js version of bcrypt which does not require compiling. https://github.com/shaneGirish/bcrypt-nodejs

    npm install bcrypt-nodejs
    

    The api is very similar to the compiled version. The following is taken directly from the readme

    Basic usage:

    Synchronous

    var hash = bcrypt.hashSync("bacon");
    
    bcrypt.compareSync("bacon", hash); // true
    bcrypt.compareSync("veggies", hash); // false
    

    Asynchronous

    bcrypt.hash("bacon", null, null, function(err, hash) {
        // Store hash in your password DB.
    });
    
    // Load hash from your password DB.
    bcrypt.compare("bacon", hash, function(err, res) {
        // res == true
    });
    bcrypt.compare("veggies", hash, function(err, res) {
        // res = false
    });
    

提交回复
热议问题