Mongojs:在openshift中错误的ELF类:ELFCLASS32 nodejs应用程序

我有一个本地运行良好的nodejs(expressjs)应用程序,但是当我将它部署到Openshift时,我收到一个exception,当我检查日志文件时,它包含此行在server.js中有以下错误。

var mongojs = require("mongojs"); 

 DEBUG: Sending SIGTERM to child... DEBUG: Running node-supervisor with DEBUG: program 'server.js' DEBUG: --watch '/var/lib/openshift/5522627bfcf9336fbc00016a/app-root/data/.nodewatch' DEBUG: --ignore 'undefined' DEBUG: --extensions 'node|js|coffee' DEBUG: --exec 'node' DEBUG: Starting child process with 'node server.js' DEBUG: Watching directory '/var/lib/openshift/5522627bfcf9336fbc00016a/app-root/data/.nodewatch' for changes. [Error: /var/lib/openshift/5522627bfcf9336fbc00016a/app-root/runtime/repo/node_modules/mongojs/node_modules/mongodb/node_modules/bson/build/Release/bson.node: wrong ELF class: ELFCLASS32] js-bson: Failed to load c++ bson extension, using pure JS version App is running on port : 3000 

它看起来像你的bson或mongodb是为32位系统而构build的,但是你正试图在64位系统(或其他架构)上加载它。

我想你有一个32位系统,你也正在部署构build的二进制文件。

你是如何在你的系统上安装mongodb的? 尝试从源代码重新安装到目标系统上(尝试删除node_modules目录,然后再次运行npm install)。

作为未来的build议,通常只部署项目的package.json文件并在本地执行npm install是个好主意。