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

home2 게시판 Node.js, Express 게시판 특이한 path must be absolute or specify 오류

특이한 path must be absolute or specify 오류

3 글 보임 - 1 에서 3 까지 (총 3 중에서)
  • 글쓴이
  • #39463

    Seongju Kang
    참가자
    TypeError: path must be absolute or specify root to res.sendFile
    at ServerResponse.sendFile (C:\Users102\Desktop\Coding Apple\Node.js\todoapp\node_modules\express\lib\response.js:441:11)
        at C:\Users102\Desktop\Coding Apple\Node.js\todoapp\server.js:29:8
        at Layer.handle [as handle_request] (C:\Users102\Desktop\Coding Apple\Node.js\todoapp\node_modules\express\lib\router\layer.js:95:5)
        at next (C:\Users102\Desktop\Coding Apple\Node.js\todoapp\node_modules\express\lib\router\route.js:144:13)
        at Route.dispatch (C:\Users102\Desktop\Coding Apple\Node.js\todoapp\node_modules\express\lib\router\route.js:114:3)
        at Layer.handle [as handle_request] (C:\Users102\Desktop\Coding Apple\Node.js\todoapp\node_modules\express\lib\router\layer.js:95:5)
        at C:\Users102\Desktop\Coding Apple\Node.js\todoapp\node_modules\express\lib\router\index.js:284:15     
        at Function.process_params (C:\Users102\Desktop\Coding Apple\Node.js\todoapp\node_modules\express\lib\router\index.js:346:12)
        at next (C:\Users102\Desktop\Coding Apple\Node.js\todoapp\node_modules\express\lib\router\index.js:280:10)
        at SessionStrategy.strategy.pass (C:\Users102\Desktop\Coding Apple\Node.js\todoapp\node_modules\passport\lib\middleware\authenticate.js:346:9)
    
    파트3 로그인 세션 강의를 듣던 중 
    뜬금없이 나온 오류입니다
    stack overflow에 검색해보니
    redirect의 절대 경로를 설정해야 혹시나 제대로 처리가 안될때 ('/' index.ejs 말하는듯)
    index.ejs로 돌아간다... 저는 뭐 이런식으로 이해했는데요
     
    특이한건 '/' 는 과거에 이미 작성했기 때문에
    지금까지는 아무런 문제가 없었는데 오늘 로그인 세션쪽 세션 쿠키가 생성되는지
    확인하러 id 와 pw 에 test를 입력하니 저런 에러가 떴습니다
     
    그래서 확인해보니 localhost 8080 / (기본) 도 안들어가지고
    write.ejs 도 동일한 오류가 뜨는데
    재밌는건 list나 edit페이지는 멀쩡하게 들어가진다는 것입니다
    그리고 개발자도구 - 애플리케이션의 쿠키 역시 멀쩡하게 잘 생성이 됩니다(login 페이지도 잘 들어가지구요)
    nodemon으로 server.js할때도 listening on 8080 역시 정상적으로 뜨구요.
     
    이런 경우에 혹시 어디부터 살펴봐야 할까요?
    
    
    		
    	
    #39476

    codingapple
    키 마스터
    의심되는 부분들 하나씩 주석처리해보면서 테스트해봅시다
    #39480

    Seongju Kang
    참가자
    아 선생님
    찾았습니다!
    
    
    챕터 2 마지막강의에서
    write 페이지와 index 페이지를 마지막에 render로 바꾸라고 하셨는데
    제가 ejs로 변환해서 파일명만 바꾼 채 views 안에는 넣었지만
    server.js에서 sendfile로 만든 경로가 index.ejs 로 그대로 남아있어서(render처리는 안함)
    생긴 오류였습니다.
    깔끔하게 해결되었고
    현재 문제였던 index 페이지와 write 페이지가 잘 들어가집니다
    비밀번호 test 입력 단계부터 잘 수강하겠습니다!
     
3 글 보임 - 1 에서 3 까지 (총 3 중에서)
  • 답변은 로그인 후 가능합니다.

About

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

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

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