• 로그인
  • 장바구니에 상품이 없습니다.

home2 게시판 Node.js, Express 게시판 mongodb 한후로 이상한 에러가 생겨서 해결이 안되요

mongodb 한후로 이상한 에러가 생겨서 해결이 안되요

  • 이 주제에는 6개 답변, 2명 참여가 있으며 치칫2 년, 2 월 전에 전에 마지막으로 업데이트했습니다.
7 글 보임 - 1 에서 7 까지 (총 7 중에서)
  • 글쓴이
  • #81205

    치칫
    참가자
    
    그전에는 nodemon server.js 하면 잘됐는대 몽고디비 할려고 한후부터 이상한 에러가 생겼어요
    폴더 삭제까지하고 처음부터 다시 다 따라해봤고요 복사붙여넣기로도 다 해봤는대 그냥 안돼요
    이유를 모르겠어요
    멘탈 나갔어요..
    #81206

    치칫
    참가자
    [nodemon] 2.0.22
    [nodemon] to restart at any time, enter `rs`
    [nodemon] watching path(s): *.*
    [nodemon] watching extensions: js,mjs,json
    [nodemon] starting `node server.js`
    C:\Users\PC\Desktop\node\server.js:2
    app.use(express.urlencoded({ extended: true }));
    ^
    ReferenceError: Cannot access 'app' before initialization
        at Object.<anonymous> (C:\Users\PC\Desktop\node\server.js:2:1)
        at Module._compile (node:internal/modules/cjs/loader:1254:14)
        at Module._extensions..js (node:internal/modules/cjs/loader:1308:10)
        at Module.load (node:internal/modules/cjs/loader:1117:32)
        at Module._load (node:internal/modules/cjs/loader:958:12)
        at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
        at node:internal/main/run_main_module:23:47
    Node.js v18.16.0
    [nodemon] app crashed - waiting for file changes before starting...
    
    
    ㅡㅡㅡㅡ
    터미널에 nodemon server.js 친후로 나오는거입니다
    #81229

    codingapple
    키 마스터
    app.use 어쩌구를 더 밑으로 내립시다
    #81309

    치칫
    참가자
    `
    #81311

    치칫
    참가자
    (node:11712) [MONGODB DRIVER] Warning: Current Server Discovery and Monitoring engine is deprecated, and will be removed in a future version. To use the new Server Discover and Monitoring engine, pass option { useUnifiedTopology: true } to the MongoClient constructor.
    (Use `node --trace-warnings ...` to show where the warning was created)
    MongoNetworkError: failed to connect to server [ac-mncro5m-shard-00-00.kgdk9mh.mongodb.net:27017] on first connect [MongoNetworkError: connection 5 to ac-mncro5m-shard-00-00.kgdk9mh.mongodb.net:27017 closed
        at TLSSocket.<anonymous> (C:\Users\PC\Desktop\node\node_modules\mongodb\lib\core\connection\connection.js:443:9)
        at Object.onceWrapper (node:events:628:26)
        at TLSSocket.emit (node:events:513:28)
        at node:net:322:12
        at TCP.done (node:_tls_wrap:588:7)]
        at Pool.<anonymous> (C:\Users\PC\Desktop\node\node_modules\mongodb\lib\core\topologies\server.js:441:11)
        at Pool.emit (node:events:513:28)
        at C:\Users\PC\Desktop\node\node_modules\mongodb\lib\core\connection\pool.js:564:14
        at C:\Users\PC\Desktop\node\node_modules\mongodb\lib\core\connection\pool.js:1014:9
        at callback (C:\Users\PC\Desktop\node\node_modules\mongodb\lib\core\connection\connect.js:75:5)
        at C:\Users\PC\Desktop\node\node_modules\mongodb\lib\core\connection\connect.js:101:9
        at _callback (C:\Users\PC\Desktop\node\node_modules\mongodb\lib\core\connection\connection.js:332:7)
        at Connection.errorHandler (C:\Users\PC\Desktop\node\node_modules\mongodb\lib\core\connection\connection.js:347:7)
        at Object.onceWrapper (node:events:628:26)
        at Connection.emit (node:events:513:28)
    [nodemon] clean exit - waiting for changes before restart
    ㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡ
    선생님 죄송한대 말씀하신대로 적으니까 nodemon server.js 를 하면 이렇게 나와요
    파파고 돌려보니까 mongodb버전이 낮다? 그런뜻 같은데 최신버전으로 했거든요 npm install mongodb했습니다
    어떻게 해야할까요 지금 몽고디비 사이트가 영상이랑 다른점이 많아서 좀 헷갈리네요ㅠ ㅠ
    #81332

    codingapple
    키 마스터
    npm uninstall mongodb한 다음 npm install mongodb@3.6.4 하고
    DB접속 URL 맞는지 다시 확인해봅시다
    #81339

    치칫
    참가자
    구문만 신경썼는대 ip를 잘못했었네요...... 해결 된거같습니다 
    감사합니다
7 글 보임 - 1 에서 7 까지 (총 7 중에서)
  • 답변은 로그인 후 가능합니다.

About

현재 월 700명 신규수강중입니다.

  (09:00~20:00) 빠른 상담은 카톡 플러스친구 코딩애플 (링크)
  admin@codingapple.com
  이용약관
ⓒ Codingapple, 강의 예제, 영상 복제 금지
top

© Codingapple, All rights reserved. 슈퍼로켓 에듀케이션 / 서울특별시 강동구 고덕로 19길 30 / 사업자등록번호 : 212-26-14752 온라인 교육학원업 / 통신판매업신고번호 : 제 2017-서울강동-0002 호 / 개인정보관리자 : 박종흠