【发布时间】:2019-01-02 06:53:28
【问题描述】:
我在 Google Compute Engine 实例上有一个 KeystoneJS 应用,在我的项目文件夹中执行 mongod 和 npm start 后,我运行 gcloud app deploy 并收到以下错误:
Mongoose connection "error" event fired with:
{ MongoError: failed to connect to server [localhost:27017] on first connect
at Pool.<anonymous> (/app/node_modules/mongodb-core/lib/topologies/server.js:326:35)
at Pool.emit (events.js:182:13)
at Connection.<anonymous> (/app/node_modules/mongodb-core/lib/connection/pool.js:272:12)
at Object.onceWrapper (events.js:273:13)
at Connection.emit (events.js:182:13)
at Socket.<anonymous> (/app/node_modules/mongodb-core/lib/connection/connection.js:175:49)
at Object.onceWrapper (events.js:273:13)
at Socket.emit (events.js:182:13)
at emitErrorNT (internal/streams/destroy.js:82:8)
at emitErrorAndCloseNT (internal/streams/destroy.js:50:3)
at process._tickCallback (internal/process/next_tick.js:63:19)
name: 'MongoError',
message:
'failed to connect to server [localhost:27017] on first connect' }
Error: KeystoneJS (Modern Marketing) failed to start - Check that you are running `mongod` in a separate process.
at NativeConnection.<anonymous> (/app/node_modules/keystone/lib/core/openDatabaseConnection.js:59:10)
at NativeConnection.emit (events.js:182:13)
at Immediate.<anonymous> (/app/node_modules/mongoose/lib/connection.js:296:19)
at runCallback (timers.js:705:18)
at tryOnImmediate (timers.js:676:5)
at processImmediate (timers.js:658:5)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! modern-marketing@0.0.0 start: `node keystone.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the modern-marketing@0.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2019-01-02T05_59_39_493Z-debug.log
我没有太多使用 MongoDB 或 KeystoneJS 的经验,因此感谢任何见解
【问题讨论】:
-
您在 Compute Engine 上说它,但您正在运行 App Engine 命令。你能澄清一下你实际使用的是什么产品吗?它们是两种截然不同的产品。
标签: node.js mongodb google-app-engine google-compute-engine keystonejs