Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot install bcrypt node.js module on Centos Server

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

info postuninstall [email protected]
ERR! [email protected] install: `make build`
ERR! `sh "-c" "make build"` failed with 2
ERR!
ERR! Failed at the [email protected] install script.
ERR! This is most likely a problem with the bcrypt package,
ERR! not with npm itself.
ERR! Tell the author that this fails on your system:
ERR!     make build
ERR! You can get their info via:
ERR!     npm owner ls bcrypt
ERR! There is likely additional logging output above.
ERR!
ERR! System Linux 2.6.18-028stab095.1
ERR! command "nodejs" "/usr/bin/npm" "install" "bcrypt"
ERR! cwd /root/grouplo
ERR! node -v v0.6.15
ERR! npm -v 1.1.16
ERR! code ELIFECYCLE
ERR! message [email protected] install: `make build`
ERR! message `sh "-c" "make build"` failed with 2
ERR! errno {}

What Can I do to solve this? Thanks,

like image 601
Feras Odeh Avatar asked Apr 14 '12 11:04

Feras Odeh


1 Answers

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
});
like image 200
Noah Avatar answered Oct 13 '22 08:10

Noah