Michal Zimmermann Michal Zimmermann - 5 months ago 56
Node.js Question

How to install bcrypt for nodejs on Openshift?

Using https://github.com/icflorescu/openshift-cartridge-nodejs to get recent version of node, I ran

npm install
and got the following error:

npm ERR! Linux 2.6.32-573.12.1.el6.x86_64
npm ERR! argv "/var/lib/openshift/56c8cd172d527182dd0000e7/app-root/data/.nodejs/bin/node" "/var/lib/openshift/56c8cd172d527182dd0000e7/app-root/data/.nodejs/bin/npm" "install"
npm ERR! node v5.6.0
npm ERR! npm v3.7.3
npm ERR! code ELIFECYCLE

npm ERR! bcrypt@0.8.5 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the bcrypt@0.8.5 install script 'node-gyp rebuild'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the bcrypt package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs bcrypt
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls bcrypt
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! /var/lib/openshift/56c8cd172d527182dd0000e7/app-root/runtime/repo/src/bookmap/npm-debug.log


I already tried to explicitly list
node-gyp
as a dependency in
package.json
, which results in the same error. Here's my current dependencies from
package.json
:

"dependencies": {
"angular": "^1.4.8",
"angular-datepicker": "~1.0.5",
"angular-route": "^1.4.8",
"angular-simple-logger": "^0.1.7",
"angular-ui-bootstrap": "^0.14.3",
"node-gyp": "",
"bcrypt": "^0.8.5",
"body-parser": "^1.14.1",
"bootstrap": "^3.3.6",
"bower": "^1.3.9",
"express": "^4.13.3",
"gulp": "^3.8.7",
"gulp-connect": "^2.0.6",
"jwt-simple": "^0.4.0",
"leaflet": "^0.7.7",
"lodash": "^3.10.1",
"path": "^0.12.7",
"pg": "^4.4.3",
"ui-leaflet": "^1.0.0",
"winston": "^2.1.1"
}


node-gyp installs just fine with
npm install node-gyp
.

Ben Ben
Answer

I recommend using the javascript version of bcrypt so you don't have to deal with building it on openshift. We use bcrypt-nodejs on openshift and it works well https://www.npmjs.com/package/bcrypt-nodejs

All you need is just to put it under dependencies in package.json. This is what we have but you can check and get the latest version:

"bcrypt-nodejs": ">=0.0.3",