Error Handling/에러핸들링

MongooseServerSelectionError: connect ECONNREFUSED ::1:27017 몽고디비 연결 에러

sangwoo_rhie 2023. 7. 7. 11:47

 

 

 

아래와 같은 에러가 뜬다면, 시작화면 검색에 서비스 접속 -> 서비스에 들어가서 MongoDB 서버 시작하면 된다.

MongooseServerSelectionError: connect ECONNREFUSED ::1:27017
    at Connection.openUri (C:\Users\admin\Desktop\코딩\NODE\4th Week\SPA_MALL\node_modules\mon
goose\lib\connection.js:825:32)
    at C:\Users\admin\Desktop\코딩\NODE\4th Week\SPA_MALL\node_modules\mongoose\lib\index.js:4
09:10
    at C:\Users\admin\Desktop\코딩\NODE\4th Week\SPA_MALL\node_modules\mongoose\lib\helpers\pr
omiseOrCallback.js:41:5
    at new Promise (<anonymous>)
    at promiseOrCallback (C:\Users\admin\Desktop\코딩\NODE\4th Week\SPA_MALL\node_modules\mong
oose\lib\helpers\promiseOrCallback.js:40:10)
    at Mongoose._promiseOrCallback (C:\Users\admin\Desktop\코딩\NODE\4th Week\SPA_MALL\node_mo
dules\mongoose\lib\index.js:1262:10)
    at Mongoose.connect (C:\Users\admin\Desktop\코딩\NODE\4th Week\SPA_MALL\node_modules\mongo
ose\lib\index.js:408:20)
    at connect (C:\Users\admin\Desktop\코딩\NODE\4th Week\SPA_MALL\schemas\index.js:6:6)      
    at Object.<anonymous> (C:\Users\admin\Desktop\코딩\NODE\4th Week\SPA_MALL\app.js:15:1)    
    at Module._compile (node:internal/modules/cjs/loader:1254:14) {
  reason: TopologyDescription {
    type: 'Unknown',
    servers: Map(1) { 'localhost:27017' => [ServerDescription] },
    stale: false,
    compatible: true,
    heartbeatFrequencyMS: 10000,
    localThresholdMS: 15,
    setName: null,
    maxElectionId: null,
    maxSetVersion: null,
    commonWireVersion: 0,
    logicalSessionTimeoutMinutes: null
  },
  code: undefined
}
몽고디비 연결 에러 MongooseServerSelectionError: connect ECONNREFUSED ::1:27017
    at Connection.openUri (C:\Users\admin\Desktop\코딩\NODE\4th Week\SPA_MALL\node_modules\mon
goose\lib\connection.js:825:32)
    at C:\Users\admin\Desktop\코딩\NODE\4th Week\SPA_MALL\node_modules\mongoose\lib\index.js:4
09:10
    at C:\Users\admin\Desktop\코딩\NODE\4th Week\SPA_MALL\node_modules\mongoose\lib\helpers\pr
omiseOrCallback.js:41:5
    at new Promise (<anonymous>)
    at promiseOrCallback (C:\Users\admin\Desktop\코딩\NODE\4th Week\SPA_MALL\node_modules\mong
oose\lib\helpers\promiseOrCallback.js:40:10)
    at Mongoose._promiseOrCallback (C:\Users\admin\Desktop\코딩\NODE\4th Week\SPA_MALL\node_mo
dules\mongoose\lib\index.js:1262:10)
    at Mongoose.connect (C:\Users\admin\Desktop\코딩\NODE\4th Week\SPA_MALL\node_modules\mongo
ose\lib\index.js:408:20)
    at connect (C:\Users\admin\Desktop\코딩\NODE\4th Week\SPA_MALL\schemas\index.js:6:6)      
    at Object.<anonymous> (C:\Users\admin\Desktop\코딩\NODE\4th Week\SPA_MALL\app.js:15:1)    
    at Module._compile (node:internal/modules/cjs/loader:1254:14) {
  reason: TopologyDescription {
    type: 'Unknown',
    servers: Map(1) { 'localhost:27017' => [ServerDescription] },
    stale: false,
    compatible: true,
    heartbeatFrequencyMS: 10000,
    localThresholdMS: 15,
    setName: null,
    maxElectionId: null,
    maxSetVersion: null,
    commonWireVersion: 0,
    logicalSessionTimeoutMinutes: null
  },
  code: undefined
}