node.js - Mongoose Can't Connect Without Internet -
i have mongodb server running on localhost:27017
, , while can run node.js app fine, when disconnect internet mongoose throws error
error: failed connect [localhost:27017]
note can still connect mongodb server mongo shell client. also, if start app first , lose internet connection, app can access database fine offline. why can't start without internet?
edit: here error in full
events.js:85 throw er; // unhandled 'error' event ^ error: failed connect [localhost:27017] @ null.<anonymous> (<my app>\node_modules\mongoose\ node_modules\mongodb\lib\mongodb\connection\server.js:555:74) @ emit (events.js:118:17) @ null.<anonymous> (<my app>\node_modules\mongoose\ node_modules\mongodb\lib\mongodb\connection\connection_pool.js:156:15) @ emit (events.js:110:17) @ socket.<anonymous> (<my app>\node_modules\mongoos e\node_modules\mongodb\lib\mongodb\connection\connection.js:534:10) @ socket.emit (events.js:107:17) @ net.js:923:16 @ process._tickcallback (node.js:355:11) [nodemon] app crashed - waiting file changes before starting...
edit: wording
use 127.0.0.1 instead of localhost. turning off wifi interface os no longer able resolve localhost.
Comments
Post a Comment