【问题标题】:KeystoneJS v4 on NodeJS v7 on Openshift - MemoryStore is not designed for production environmentKeystoneJS v4 on NodeJS v7 on Openshift - MemoryStore 不是为生产环境设计的
【发布时间】:2022-02-10 13:26:49
【问题描述】:

我正在尝试在运行最新 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.

我不太确定,这些错误消息中的哪一个可能是根本原因。有没有人有类似的问题?

感谢任何帮助。

西蒙

【问题讨论】:

    标签: node.js openshift keystonejs


    【解决方案1】:

    您需要在另一个选项卡上启动 MongoDB

     ~: mongod
    

    和 转到文件(在您的项目中):

    'node_modules/mongoose/node_modules/mongodb/node_modules/bson/ext/index.js'
    

    改变

    bson = require('../build/Release/bson');
    

    到

    bson = require('bson');
    

    但是在你遇到另一个问题之后:

    DeprecationWarning:在没有 new 的情况下使用 Buffer 将很快停止 在职的。使用new Buffer(),或者最好使用Buffer.from(), 改为Buffer.allocUnsafe() 或Buffer.alloc()。

    不是Error而是localhost:3000不运行,不知道怎么办

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-11-05
      • 2015-10-15
      • 1970-01-01
      • 1970-01-01
      • 2022-11-14
      • 2017-12-06
      • 1970-01-01
      • 2012-08-11
      相关资源
      最近更新 更多