我将keystonejs-demo部署到heroku。它说成功播放了,但是在我尝试运行该应用程序时抛出错误:
2019-04-23T16:17:45.643784+00:00 app[web.1]: 'failed to connect to server [mongo-cluster-ixqtu.mongodb.net:27017] on first connect [MongoError: getaddrinfo ENOTFOUND mongo-cluster-ixqtu.mongodb.net mongo-cluster-ixqtu.mongodb.net:27017]' }
2019-04-23T16:17:45.645113+00:00 app[web.1]: Error: KeystoneJS (Keystone Demo) failed to start - Check that you are running `mongod` in a separate process.
2019-04-23T16:17:45.645116+00:00 app[web.1]: at NativeConnection.<anonymous> (/app/node_modules/keystone/lib/core/openDatabaseConnection.js:62:10)
2019-04-23T16:17:45.645117+00:00 app[web.1]: at NativeConnection.emit (events.js:189:13)
2019-04-23T16:17:45.645119+00:00 app[web.1]: at /app/node_modules/mongoose/lib/connection.js:824:17
2019-04-23T16:17:45.645120+00:00 app[web.1]: at connectCallback (/app/node_modules/mongodb/lib/mongo_client.js:527:5)
2019-04-23T16:17:45.645121+00:00 app[web.1]: at /app/node_modules/mongodb/lib/mongo_client.js:418:11
2019-04-23T16:17:45.645123+00:00 app[web.1]: at process._tickCallback (internal/process/next_tick.js:61:11)
2019-04-23T16:18:17.397825+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=keystone-md2.herokuapp.com request_id=d7ff1bf6-735a-4312-96e6-6ec889a154eb fwd="193.238.220.38" dyno= connect= service= status=503 bytes= protocol=https
2019-04-23T16:18:18.027043+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=keystone-md2.herokuapp.com request_id=0a56b395-e71d-4162-bb21-18e265b31fd8 fwd="193.238.220.38" dyno= connect= service= status=503 bytes= protocol=https
连接代码:
'mongo': process.env.MONGO_URI || process.env.MONGOLAB_URI || 'mongodb://localhost/keystone-demo',