(node:1129) UnhandledPromiseRejectionWarning: MongooseServerSelectionError: connect ECONNREFUSED 127.0.0.1:27017
at NativeConnection.Connection.openUri (/workspace/webdevbootcamp/YelpCamp/v3/node_modules/mongoose/lib/connection.js:800:32)
at cb (/workspace/webdevbootcamp/YelpCamp/v3/node_modules/mongoose/lib/index.js:341:10)
at Promise (/workspace/webdevbootcamp/YelpCamp/v3/node_modules/mongoose/lib/helpers/promiseOrCallback.js:31:5)
at new Promise (<anonymous>)
at promiseOrCallback (/workspace/webdevbootcamp/YelpCamp/v3/node_modules/mongoose/lib/helpers/promiseOrCallback.js:30:10)
at Mongoose.connect (/workspace/webdevbootcamp/YelpCamp/v3/node_modules/mongoose/lib/index.js:340:10)
at Object.<anonymous> (/workspace/webdevbootcamp/YelpCamp/v3/app.js:9:10)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
(node:1129) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by reje
cting a promise which was not handled with .catch(). (rejection id: 1)
데이터를 불러올 mongodb와 연결에 문제가 있을 경우 발생한다.
1. mongodb가 실행되어 있는지 확인
mongdb 실행 명령어: mongod
2. mongoose와 mongodb connection을 확인한다. 기본 포트는 27017이다.
// mongodb와 mongoose 연결하여 js로 mongodb 사용 가능하게 설정한다. 27017은 mongodb의 기본 포트
mongoose.connect("mongodb://localhost:27017/yelp_camp", {useNewUrlParser: true, useUnifiedTopology: true});
'실무에서 자주 발생하는 이슈 내역' 카테고리의 다른 글
UnhandledPromiseRejectionWarning: MongoParseError: Invalid connection string at parseConnectionString (0) | 2020.09.30 |
---|---|
java.io.IOException: Permission denied (0) | 2020.09.27 |
CNN Fear & Greed Index - 버핏 할아버지가 남들이 욕심 부릴 때 팔고, 두려워 할 때 주식을 사라고 하셨어!! (0) | 2020.03.30 |
미국의 네이버 종토방? 스톡위츠(Stocktwits)! 실시간 시세도 확인! (0) | 2020.03.29 |