我是Node.js的新手。所以我嘗試了parse-example將我的Node.js應用程序與Mongo DB連接起來。所以在我安裝了所有東西之後,改變了Master和AppID(在Index.js和script.js中),我嘗試啓動我的應用程序(npm start),然後出現這些警告。Node.js無法連接到Mongo DB
> > [email protected] start C:\Users\TAASCTI5\temp\parseex\parse-server-e
> xample
> > node index.js
>
> DATABASE_URI not specified, falling back to localhost.
> parse-server-example running on port 1337.
> info: Parse LiveQuery Server starts running
> warn: Unable to ensure uniqueness for usernames: MongoError: failed to connect
> to server [localhost:27017] on first connect
> at Pool.<anonymous> (C:\Users\TAASCTI5\temp\parseex\parse-server-example\nod
> e_modules\parse-server\node_modules\mongodb-core\lib\topologies\server.js:313:35
> )
> at emitOne (events.js:96:13)
> at Pool.emit (events.js:188:7)
> at Connection.<anonymous> (C:\Users\TAASCTI5\temp\parseex\parse-server-examp
> le\node_modules\parse-server\node_modules\mongodb-core\lib\connection\pool.js:26
> 0:12)
> at Connection.g (events.js:291:16)
> at emitTwo (events.js:106:13)
> at Connection.emit (events.js:191:7)
> at Socket.<anonymous> (C:\Users\TAASCTI5\temp\parseex\parse-server-example\n
> ode_modules\parse-server\node_modules\mongodb-core\lib\connection\connection.js:
> 162:49)
> at Socket.g (events.js:291:16)
> at emitOne (events.js:96:13)
> warn: Unable to ensure uniqueness for user email addresses: MongoError: failed
> to connect to server [localhost:27017] on first connect
> at Pool.<anonymous> (C:\Users\TAASCTI5\temp\parseex\parse-server-example\nod
> e_modules\parse-server\node_modules\mongodb-core\lib\topologies\server.js:313:35
> )
> at emitOne (events.js:96:13)
> at Pool.emit (events.js:188:7)
> at Connection.<anonymous> (C:\Users\TAASCTI5\temp\parseex\parse-server-examp
> le\node_modules\parse-server\node_modules\mongodb-core\lib\connection\pool.js:26
> 0:12)
> at Connection.g (events.js:291:16)
> at emitTwo (events.js:106:13)
> at Connection.emit (events.js:191:7)
> at Socket.<anonymous> (C:\Users\TAASCTI5\temp\parseex\parse-server-example\n
> ode_modules\parse-server\node_modules\mongodb-core\lib\connection\connection.js:
> 162:49)
> at Socket.g (events.js:291:16)
> at emitOne (events.js:96:13)
> (node:18132) UnhandledPromiseRejectionWarning: Unhandled promise rejection (reje
> ction id: 4): MongoError: failed to connect to server [localhost:27017] on first
> connect
> (node:18132) UnhandledPromiseRejectionWarning: Unhandled promise rejection (reje
> ction id: 5): MongoError: failed to connect to server [localhost:27017] on first
> connect
結果是我無法連接到我的Mongo DB,出現錯誤500內部服務器錯誤。
你需要發佈你的代碼......但是看起來你沒有在你的計算機上本地運行mongodb。它可能已安裝,但可能未運行。 – Randy