如何在Openshift上为nodejs安装bcrypt?

时间:2016-02-20 21:23:42

标签: node.js openshift

使用https://github.com/icflorescu/openshift-cartridge-nodejs获取最新版本的节点,我运行npm install并收到以下错误:

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

我已经尝试在node-gyp中明确列出package.json作为依赖项,这会导致相同的错误。这是我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与npm install node-gyp安装得很好。

2 个答案:

答案 0 :(得分:2)

我建议使用bcrypt的javascript版本,这样你就不必在openshift上构建它了。我们在openshift上使用bcrypt-nodejs,它运行良好https://www.npmjs.com/package/bcrypt-nodejs

您只需将它放在package.json中的依赖项下即可。这就是我们所拥有的,但您可以查看并获取最新版本:

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

答案 1 :(得分:0)

bcrypt-nodejs无法在openshift中运行。 使用此https://www.npmjs.com/package/bcryptjs