我正在尝试在运行最新NodeJS(v7)的Openshift上部署KeystoneJS应用程序,在遇到其他一些问题后,我遇到了此错误消息
Mongo Error:
Error: connection closed
at exports.ConnectionPool.<anonymous> (/var/lib/openshift/5816407e89f5cfcee800001c/app-root/runtime/repo/node_modules/mongodb/lib/mongodb/connection/server.js:608:24)
at emitNone (events.js:86:13)
at exports.ConnectionPool.emit (events.js:185:7)
at exports.Connection.<anonymous> (/var/lib/openshift/5816407e89f5cfcee800001c/app-root/runtime/repo/node_modules/mongodb/lib/mongodb/connection/connection_pool.js:171:15)
at emitTwo (events.js:106:13)
at exports.Connection.emit (events.js:191:7)
at Socket.<anonymous> (/var/lib/openshift/5816407e89f5cfcee800001c/app-root/runtime/repo/node_modules/mongodb/lib/mongodb/connection/connection.js:550:12)
at emitOne (events.js:96:13)
at Socket.emit (events.js:188:7)
at TCP._handle.close [as _onclose] (net.js:501:12)
/var/lib/openshift/5816407e89f5cfcee800001c/app-root/runtime/repo/node_modules/keystone/lib/core/mount.js:630
throw new Error('KeystoneJS (' + keystone.get('name') + ') failed to start');
^
Error: KeystoneJS (XYZ Web) failed to start
at NativeConnection.<anonymous> (/var/lib/openshift/5816407e89f5cfcee800001c/app-root/runtime/repo/node_modules/keystone/lib/core/mount.js:630:10)
at emitOne (events.js:96:13)
at NativeConnection.emit (events.js:188:7)
at NativeConnection.Connection.error (/var/lib/openshift/5816407e89f5cfcee800001c/app-root/runtime/repo/node_modules/mongoose/lib/connection.js:389:8)
at /var/lib/openshift/5816407e89f5cfcee800001c/app-root/runtime/repo/node_modules/mongoose/lib/connection.js:416:14
at /var/lib/openshift/5816407e89f5cfcee800001c/app-root/runtime/repo/node_modules/mongoose/lib/drivers/node-mongodb-native/connection.js:57:21
at /var/lib/openshift/5816407e89f5cfcee800001c/app-root/runtime/repo/node_modules/mongodb/lib/mongodb/db.js:286:18
at /var/lib/openshift/5816407e89f5cfcee800001c/app-root/runtime/repo/node_modules/mongodb/lib/mongodb/db.js:365:7
at _combinedTickCallback (internal/process/next_tick.js:67:7)
at process._tickCallback (internal/process/next_tick.js:98:9)
{ Error: Cannot find module '../build/Release/bson'
at Function.Module._resolveFilename (module.js:472:15)
at Function.Module._load (module.js:420:25)
at Module.require (module.js:500:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/var/lib/openshift/5816407e89f5cfcee800001c/app-root/runtime/repo/node_modules/bson/ext/index.js:15:10)
at Module._compile (module.js:573:32)
at Object.Module._extensions..js (module.js:582:10)
at Module.load (module.js:490:32)
at tryModuleLoad (module.js:449:12)
at Function.Module._load (module.js:441:3)
at Module.require (module.js:500:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/var/lib/openshift/5816407e89f5cfcee800001c/app-root/runtime/repo/node_modules/bson/lib/bson/index.js:3:24)
at Module._compile (module.js:573:32)
at Object.Module._extensions..js (module.js:582:10)
at Module.load (module.js:490:32) code: 'MODULE_NOT_FOUND' }
js-bson: Failed to load c++ bson extension, using pure JS version
Warning: connect.session() MemoryStore is not
designed for a production environment, as it will leak
memory, and will not scale past a single process.
Got SIGTERM, stopping workers...
(node:20870) DeprecationWarning: Using Buffer without `new` will soon stop working. Use `new Buffer()`, or preferably `Buffer.from()`, `Buffer.allocUnsafe()` or `Buffer.alloc()` instead.
我不确定,这些错误消息中的哪一个可能是根本原因。有没有人有类似的问题?
感谢任何帮助。
希蒙
答案 0 :(得分:0)
您需要在另一个标签
上启动MongoDB ~: mongod
,和 转到文件(在您的项目中):
'node_modules/mongoose/node_modules/mongodb/node_modules/bson/ext/index.js'
并更改
bson = require('../build/Release/bson');
到
bson = require('bson');
但是在你遇到另一个问题之后:
弃用警告:使用不带
new
的缓冲区很快就会停止 工作。使用new Buffer()
,或者最好Buffer.from()
, 而是Buffer.allocUnsafe()
或Buffer.alloc()
。
它不是错误但是localhost:3000不运行,用它做什么,我不知道