본문 바로가기

Coding/내일배움캠프

[내일배움캠프] 최종 프로젝트 Day 31 | Node.js 4기 | Day 112 | 24.04.25.(목)

 

<textarea

                id="description"

                class="form-control"

                placeholder="미션 설명을 작성해주세요."

                rows="3"

              >

 

코드에서 placeholder “” 안에서 <% > EJS 문법을 사용하려고 했었기 때문에 발생했던 오류.

 

 

css 파일을 불러오지 못하는 오류

 

  • 경로 설정 오류 : 절대 경로로 작성해주기

 

 

[Nest] 6692  - 2024. 04. 25. 오전 9:37:16   ERROR [ExceptionsHandler] /Users/_woo_s.j/Desktop/workspace/earth-marvel/views/createMissionPage.ejs:41
    39|           <div class="col-md-6">
    40|             <h1 class="title mb-8 text-center">
 >> 41|               <%= challengeCreationTitle %>
    42|             </h1>
    43|             <!-- [미션] 제목 필드 -->
    44|             <div class="mb-3">

challengeCreationTitle is not defined

 

 

[오전 9:51:54] Starting compilation in watch mode...

error TS6053: File '/Users/_woo_s.j/Desktop/workspace/earth-marvel/node_modules/typescript/lib/lib.es2021.full.d.ts' not found.
  The file is in the program because:
    Default library for target 'es2021'

[오전 9:51:57] Found 1 error. Watching for file changes.

 

 

[오전 9:55:42] Starting compilation in watch mode...

error TS5033: Could not write file '/Users/_woo_s.j/Desktop/workspace/earth-marvel/dist/app.controller.d.ts': ENFILE: file table overflow, open '/Users/_woo_s.j/Desktop/workspace/earth-marvel/dist/app.controller.d.ts'.

error TS5033: Could not write file '/Users/_woo_s.j/Desktop/workspace/earth-marvel/dist/app.controller.js': ENFILE: file table overflow, open '/Users/_woo_s.j/Desktop/workspace/earth-marvel/dist/app.controller.js'.

error TS5033: Could not write file '/Users/_woo_s.j/Desktop/workspace/earth-marvel/dist/app.controller.js.map': ENFILE: file table overflow, open '/Users/_woo_s.j/Desktop/workspace/earth-marvel/dist/app.controller.js.map'.

error TS5033: Could not write file '/Users/_woo_s.j/Desktop/workspace/earth-marvel/dist/app.module.d.ts': ENFILE: file table overflow, open '/Users/_woo_s.j/Desktop/workspace/earth-marvel/dist/app.module.d.ts'.

error TS5033: Could not write file '/Users/_woo_s.j/Desktop/workspace/earth-marvel/dist/app.module.js': ENFILE: file table overflow, open '/Users/_woo_s.j/Desktop/workspace/earth-marvel/dist/app.module.js'.

error TS5033: Could not write file '/Users/_woo_s.j/Desktop/workspace/earth-marvel/dist/app.module.js.map': ENFILE: file table overflow, open '/Users/_woo_s.j/Desktop/workspace/earth-marvel/dist/app.module.js.map'.

error TS5033: Could not write file '/Users/_woo_s.j/Desktop/workspace/earth-marvel/dist/app.service.d.ts': ENFILE: file table overflow, open '/Users/_woo_s.j/Desktop/workspace/earth-marvel/dist/app.service.d.ts'.

error TS5033: Could not write file '/Users/_woo_s.j/Desktop/workspace/earth-marvel/dist/app.service.js': ENFILE: file table overflow, open '/Users/_woo_s.j/Desktop/workspace/earth-marvel/dist/app.service.js'.

error TS5033: Could not write file '/Users/_woo_s.j/Desktop/workspace/earth-marvel/dist/app.service.js.map': ENFILE: file table overflow, open '/Users/_woo_s.j/Desktop/workspace/earth-marvel/dist/app.service.js.map'.

error TS6053: File '/Users/_woo_s.j/Desktop/workspace/earth-marvel/node_modules/@types/jest/index.d.ts' not found.
  The file is in the program because:
    Entry point of type library 'jest' specified in compilerOptions

error TS6053: File '/Users/_woo_s.j/Desktop/workspace/earth-marvel/node_modules/typescript/lib/lib.es2021.full.d.ts' not found.
  The file is in the program because:
    Default library for target 'es2021'

error TS6053: File '/Users/_woo_s.j/Desktop/workspace/earth-marvel/src/auth/auth.controller.ts' not found.
  The file is in the program because:
    Matched by default include pattern '**/*'

error TS6053: File '/Users/_woo_s.j/Desktop/workspace/earth-marvel/src/auth/auth.module.ts' not found.
  The file is in the program because:
    Matched by default include pattern '**/*'

error TS6053: File '/Users/_woo_s.j/Desktop/workspace/earth-marvel/src/auth/auth.service.ts' not found.
  The file is in the program because:
    Matched by default include pattern '**/*'

error TS6053: File '/Users/_woo_s.j/Desktop/workspace/earth-marvel/src/auth/dto/auth.social.dto.ts' not found.
  The file is in the program because:
    Matched by default include pattern '**/*'

error TS6053: File '/Users/_woo_s.j/Desktop/workspace/earth-marvel/src/auth/jwt.authGuard.ts' not found.
  The file is in the program because:
    Matched by default include pattern '**/*'

error TS6053: File '/Users/_woo_s.j/Desktop/workspace/earth-marvel/src/auth/jwt.strategy.ts' not found.
  The file is in the program because:
    Matched by default include pattern '**/*'

error TS6053: File '/Users/_woo_s.j/Desktop/workspace/earth-marvel/src/auth/strategies/google.strategy.ts' not found.
  The file is in the program because:
    Matched by default include pattern '**/*'

error TS6053: File '/Users/_woo_s.j/Desktop/workspace/earth-marvel/src/auth/strategies/kakao.strategy.ts' not found.
  The file is in the program because:
    Matched by default include pattern '**/*'

error TS6053: File '/Users/_woo_s.j/Desktop/workspace/earth-marvel/src/auth/strategies/naver.strategy.ts' not found.
  The file is in the program because:
    Matched by default include pattern '**/*'

error TS6053: File '/Users/_woo_s.j/Desktop/workspace/earth-marvel/src/board/board.controller.ts' not found.
  The file is in the program because:
    Matched by default include pattern '**/*'

error TS6053: File '/Users/_woo_s.j/Desktop/workspace/earth-marvel/src/board/board.module.ts' not found.
  The file is in the program because:
    Matched by default include pattern '**/*'

error TS6053: File '/Users/_woo_s.j/Desktop/workspace/earth-marvel/src/board/board.service.ts' not found.
  The file is in the program because:
    Matched by default include pattern '**/*'

error TS6053: File '/Users/_woo_s.j/Desktop/workspace/earth-marvel/src/board/dto/create_board.dto.ts' not found.
  The file is in the program because:
    Matched by default include pattern '**/*'

error TS6053: File '/Users/_woo_s.j/Desktop/workspace/earth-marvel/src/board/dto/search_board.dto.ts' not found.
  The file is in the program because:
    Matched by default include pattern '**/*'

error TS6053: File '/Users/_woo_s.j/Desktop/workspace/earth-marvel/src/board/dto/serach_board.dto.ts' not found.
  The file is in the program because:
    Matched by default include pattern '**/*'

error TS6053: File '/Users/_woo_s.j/Desktop/workspace/earth-marvel/src/board/dto/update_board.dto.ts' not found.
  The file is in the program because:
    Matched by default include pattern '**/*'

error TS6053: File '/Users/_woo_s.j/Desktop/workspace/earth-marvel/src/board/entities/board.entity.ts' not found.
  The file is in the program because:
    Matched by default include pattern '**/*'

error TS6053: File '/Users/_woo_s.j/Desktop/workspace/earth-marvel/src/board/entities/likes.entity.ts' not found.
  The file is in the program because:
    Matched by default include pattern '**/*'

error TS6053: File '/Users/_woo_s.j/Desktop/workspace/earth-marvel/src/board/socket/socket.gateway.ts' not found.
  The file is in the program because:
    Matched by default include pattern '**/*'

error TS6053: File '/Users/_woo_s.j/Desktop/workspace/earth-marvel/src/board/socket/socket.module.ts' not found.
  The file is in the program because:
    Matched by default include pattern '**/*'

error TS6053: File '/Users/_woo_s.j/Desktop/workspace/earth-marvel/src/board/types/category_status.enum.ts' not found.
  The file is in the program because:
    Matched by default include pattern '**/*'

error TS6053: File '/Users/_woo_s.j/Desktop/workspace/earth-marvel/src/comment/comment.controller.ts' not found.
  The file is in the program because:
    Matched by default include pattern '**/*'

error TS6053: File '/Users/_woo_s.j/Desktop/workspace/earth-marvel/src/comment/comment.module.ts' not found.
  The file is in the program because:
    Matched by default include pattern '**/*'

error TS6053: File '/Users/_woo_s.j/Desktop/workspace/earth-marvel/src/comment/comment.service.ts' not found.
  The file is in the program because:
    Matched by default include pattern '**/*'

error TS6053: File '/Users/_woo_s.j/Desktop/workspace/earth-marvel/src/main.ts' not found.
  The file is in the program because:
    Matched by default include pattern '**/*'

error TS6053: File '/Users/_woo_s.j/Desktop/workspace/earth-marvel/src/main/main.controller.ts' not found.
  The file is in the program because:
    Matched by default include pattern '**/*'

error TS6053: File '/Users/_woo_s.j/Desktop/workspace/earth-marvel/src/main/main.module.ts' not found.
  The file is in the program because:
    Matched by default include pattern '**/*'

error TS6053: File '/Users/_woo_s.j/Desktop/workspace/earth-marvel/src/main/main.service.ts' not found.
  The file is in the program because:
    Matched by default include pattern '**/*'

error TS6053: File '/Users/_woo_s.j/Desktop/workspace/earth-marvel/src/mission/dto/create-mission.dto.ts' not found.
  The file is in the program because:
    Matched by default include pattern '**/*'

error TS6053: File '/Users/_woo_s.j/Desktop/workspace/earth-marvel/src/mission/dto/update-mission.dto.ts' not found.
  The file is in the program because:
    Matched by default include pattern '**/*'

error TS6053: File '/Users/_woo_s.j/Desktop/workspace/earth-marvel/src/mission/entities/mission.entity.ts' not found.
  The file is in the program because:
    Matched by default include pattern '**/*'

error TS6053: File '/Users/_woo_s.j/Desktop/workspace/earth-marvel/src/mission/mission.controller.ts' not found.
  The file is in the program because:
    Matched by default include pattern '**/*'

error TS6053: File '/Users/_woo_s.j/Desktop/workspace/earth-marvel/src/mission/mission.module.ts' not found.
  The file is in the program because:
    Matched by default include pattern '**/*'

error TS6053: File '/Users/_woo_s.j/Desktop/workspace/earth-marvel/src/mission/mission.service.ts' not found.
  The file is in the program because:
    Matched by default include pattern '**/*'

error TS6053: File '/Users/_woo_s.j/Desktop/workspace/earth-marvel/src/mission/types/category.ts' not found.
  The file is in the program because:
    Matched by default include pattern '**/*'

error TS6053: File '/Users/_woo_s.j/Desktop/workspace/earth-marvel/src/mission/types/missionType.ts' not found.
  The file is in the program because:
    Matched by default include pattern '**/*'

error TS6053: File '/Users/_woo_s.j/Desktop/workspace/earth-marvel/src/planner/dto/task.dto.ts' not found.
  The file is in the program because:
    Matched by default include pattern '**/*'

error TS6053: File '/Users/_woo_s.j/Desktop/workspace/earth-marvel/src/planner/dto/update.planner.dto.ts' not found.
  The file is in the program because:
    Matched by default include pattern '**/*'

error TS6053: File '/Users/_woo_s.j/Desktop/workspace/earth-marvel/src/planner/entity/planner.entity.ts' not found.
  The file is in the program because:
    Matched by default include pattern '**/*'

error TS6053: File '/Users/_woo_s.j/Desktop/workspace/earth-marvel/src/planner/entity/task.entity.ts' not found.
  The file is in the program because:
    Matched by default include pattern '**/*'

error TS6053: File '/Users/_woo_s.j/Desktop/workspace/earth-marvel/src/planner/planner.controller.ts' not found.
  The file is in the program because:
    Matched by default include pattern '**/*'

error TS6053: File '/Users/_woo_s.j/Desktop/workspace/earth-marvel/src/planner/planner.module.ts' not found.
  The file is in the program because:
    Matched by default include pattern '**/*'

error TS6053: File '/Users/_woo_s.j/Desktop/workspace/earth-marvel/src/planner/planner.service.ts' not found.
  The file is in the program because:
    Matched by default include pattern '**/*'

error TS6053: File '/Users/_woo_s.j/Desktop/workspace/earth-marvel/src/point/dto/createPoint.dto.ts' not found.
  The file is in the program because:
    Matched by default include pattern '**/*'

error TS6053: File '/Users/_woo_s.j/Desktop/workspace/earth-marvel/src/point/entity/point.entity.ts' not found.
  The file is in the program because:
    Matched by default include pattern '**/*'

error TS6053: File '/Users/_woo_s.j/Desktop/workspace/earth-marvel/src/point/point.controller.ts' not found.
  The file is in the program because:
    Matched by default include pattern '**/*'

error TS6053: File '/Users/_woo_s.j/Desktop/workspace/earth-marvel/src/point/point.module.ts' not found.
  The file is in the program because:
    Matched by default include pattern '**/*'

error TS6053: File '/Users/_woo_s.j/Desktop/workspace/earth-marvel/src/point/point.service.ts' not found.
  The file is in the program because:
    Matched by default include pattern '**/*'

error TS6053: File '/Users/_woo_s.j/Desktop/workspace/earth-marvel/src/user/dto/emailAuth.dto.ts' not found.
  The file is in the program because:
    Matched by default include pattern '**/*'

error TS6053: File '/Users/_woo_s.j/Desktop/workspace/earth-marvel/src/user/dto/getUser.dto.ts' not found.
  The file is in the program because:
    Matched by default include pattern '**/*'

error TS6053: File '/Users/_woo_s.j/Desktop/workspace/earth-marvel/src/user/dto/login.dto.ts' not found.
  The file is in the program because:
    Matched by default include pattern '**/*'

error TS6053: File '/Users/_woo_s.j/Desktop/workspace/earth-marvel/src/user/dto/profile.dto.ts' not found.
  The file is in the program because:
    Matched by default include pattern '**/*'

error TS6053: File '/Users/_woo_s.j/Desktop/workspace/earth-marvel/src/user/dto/register.dto.ts' not found.
  The file is in the program because:
    Matched by default include pattern '**/*'

error TS6053: File '/Users/_woo_s.j/Desktop/workspace/earth-marvel/src/user/dto/withdraw.dto.ts' not found.
  The file is in the program because:
    Matched by default include pattern '**/*'

error TS6053: File '/Users/_woo_s.j/Desktop/workspace/earth-marvel/src/user/email.service.ts' not found.
  The file is in the program because:
    Matched by default include pattern '**/*'

error TS6053: File '/Users/_woo_s.j/Desktop/workspace/earth-marvel/src/user/entities/user.entity.ts' not found.
  The file is in the program because:
    Matched by default include pattern '**/*'

error TS6053: File '/Users/_woo_s.j/Desktop/workspace/earth-marvel/src/user/s3.service.ts' not found.
  The file is in the program because:
    Matched by default include pattern '**/*'

error TS6053: File '/Users/_woo_s.j/Desktop/workspace/earth-marvel/src/user/user.controller.ts' not found.
  The file is in the program because:
    Matched by default include pattern '**/*'

error TS6053: File '/Users/_woo_s.j/Desktop/workspace/earth-marvel/src/user/user.module.ts' not found.
  The file is in the program because:
    Matched by default include pattern '**/*'

error TS6053: File '/Users/_woo_s.j/Desktop/workspace/earth-marvel/src/user/user.service.ts' not found.
  The file is in the program because:
    Matched by default include pattern '**/*'

error TS6053: File '/Users/_woo_s.j/Desktop/workspace/earth-marvel/src/utils/multer.options.factory.ts' not found.
  The file is in the program because:
    Matched by default include pattern '**/*'

error TS6053: File '/Users/_woo_s.j/Desktop/workspace/earth-marvel/src/utils/scheduler/scheduler.module.ts' not found.
  The file is in the program because:
    Matched by default include pattern '**/*'

error TS6053: File '/Users/_woo_s.j/Desktop/workspace/earth-marvel/src/utils/scheduler/scheduler.service.ts' not found.
  The file is in the program because:
    Matched by default include pattern '**/*'

error TS6053: File '/Users/_woo_s.j/Desktop/workspace/earth-marvel/src/utils/userInfo.decorator.ts' not found.
  The file is in the program because:
    Matched by default include pattern '**/*'

error TS6053: File '/Users/_woo_s.j/Desktop/workspace/earth-marvel/src/vision/dto/certificateImageCategory.dto.ts' not found.
  The file is in the program because:
    Matched by default include pattern '**/*'

error TS6053: File '/Users/_woo_s.j/Desktop/workspace/earth-marvel/src/vision/entity/certificatedImage.entity.ts' not found.
  The file is in the program because:
    Matched by default include pattern '**/*'

error TS6053: File '/Users/_woo_s.j/Desktop/workspace/earth-marvel/src/vision/vision.controller.ts' not found.
  The file is in the program because:
    Matched by default include pattern '**/*'

error TS6053: File '/Users/_woo_s.j/Desktop/workspace/earth-marvel/src/vision/vision.module.ts' not found.
  The file is in the program because:
    Matched by default include pattern '**/*'

error TS6053: File '/Users/_woo_s.j/Desktop/workspace/earth-marvel/src/vision/vision.service.ts' not found.
  The file is in the program because:
    Matched by default include pattern '**/*'

[오전 9:55:43] Found 80 errors. Watching for file changes.

Debugger listening on ws://127.0.0.1:9229/9d542044-3d4d-4a2c-af89-24a893d8c393
For help, see: https://nodejs.org/en/docs/inspector
Error: Cannot find module '/Users/_woo_s.j/Desktop/workspace/earth-marvel/dist/main'
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:1142:15)
    at Function.Module._load (node:internal/modules/cjs/loader:983:27)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:142:12)
    at node:internal/main/run_main_module:28:49

 

 

????

 

 

 

[Nest] 3423  - 2024. 04. 25. 오전 10:32:13   ERROR [ExceptionsHandler] Cannot set headers after they are sent to the client
Error: Cannot set headers after they are sent to the client
    at ServerResponse.setHeader (node:_http_outgoing:703:11)
    at ServerResponse.header (/Users/_woo_s.j/Desktop/workspace/earth-marvel/node_modules/express/lib/response.js:795:10)
    at ServerResponse.contentType (/Users/_woo_s.j/Desktop/workspace/earth-marvel/node_modules/express/lib/response.js:625:15)
    at ServerResponse.send (/Users/_woo_s.j/Desktop/workspace/earth-marvel/node_modules/express/lib/response.js:150:14)
    at done (/Users/_woo_s.j/Desktop/workspace/earth-marvel/node_modules/express/lib/response.js:1044:10)
    at tryHandleCache (/Users/_woo_s.j/Desktop/workspace/earth-marvel/node_modules/ejs/lib/ejs.js:280:5)
    at View.exports.renderFile [as engine] (/Users/_woo_s.j/Desktop/workspace/earth-marvel/node_modules/ejs/lib/ejs.js:491:10)
    at View.render (/Users/_woo_s.j/Desktop/workspace/earth-marvel/node_modules/express/lib/view.js:135:8)
    at tryRender (/Users/_woo_s.j/Desktop/workspace/earth-marvel/node_modules/express/lib/application.js:657:10)
    at Function.render (/Users/_woo_s.j/Desktop/workspace/earth-marvel/node_modules/express/lib/application.js:609:3)

 

이 오류는 Express 기반 애플리케이션에서 클라이언트에 응답을 보낸 후, 다시 헤더를 설정하려고 시도했을 때 발생합니다.
클라이언트에 응답이 이미 전송된 후에는 헤더를 설정하거나 변경할 수 없기 때문에 이 오류가 발생합니다.
오류 원인 및 해결 방법:
1. 이중 응답 문제:
    * 응답 객체(res)에 대해 동일한 요청에 대해 두 번 응답을 보내려고 할 때 발생할 수 있습니다.
    * 일반적으로 여러 조건문, 콜백, 또는 비동기 코드에서 응답을 중복으로 보내려는 경우 이 문제가 발생합니다.
2. Promise 또는 비동기 코드에서의 응답:
    * 비동기 코드에서 try-catch 또는 promise에서 오류를 처리할 때, 요청에 대해 여러 번 응답할 가능성이 있습니다.
    * 이러한 경우 각 비동기 코드에서 단 한 번만 응답을 보내도록 확인해야 합니다.
해결 방법:
1. 응답 중복 방지:
    * 한 요청에 대해 응답을 단 한 번만 보내도록 코드 내에서 주의해야 합니다.
    * res.send()나 res.json(), res.status() 등의 응답 메서드를 호출하는 모든 위치에서
코드를 확인하여 동일한 요청에 대해 여러 번 호출되지 않도록 합니다.
2. 비동기 코드의 처리:
    * 비동기 코드 또는 Promise 체인 내에서 오류 처리 시, 한 번의 오류 처리로 응답이 끝나도록 코드를 검토해야 합니다.
    * 비동기 함수 내에서 오류가 발생했을 때 return 문을 사용하여 더 이상 코드를 실행하지 않도록 하는 것이 좋습니다.
3. 에러 처리 코드:
    * 에러 핸들러에서 res 객체에 대해 이미 응답을 보냈는지 여부를 확인하는 조건문을 추가하는 것을 고려해볼 수 있습니다.
    * 예를 들어 res.headersSent 속성을 확인하여 응답이 이미 전송되었는지 체크할 수 있습니다.

 

 

 

 

 

 

 

 

 

아래 코드 뜻이 뭐야? 미친 디테일로 설명해줘.

<% }) %>

ChatGPT
ChatGPT

<% }) %>는 템플릿 엔진인 EJS(Embedded JavaScript)에서 사용되는 코드 블록의 끝을 나타내는 구문입니다. 이 구문은 EJS의 제어 구조 중 하나인 forEach 루프의 끝을 표시합니다.
자세히 살펴보면, 이 구문은 다음과 같은 의미를 가집니다:
* forEach 루프는 배열을 반복하여 각 요소에 대해 특정 작업을 수행하는 제어 구조입니다.
* 루프의 시작은 일반적으로 <% 뒤에 array.forEach((item) => { 또는 for (const item of array) {와 같은 루프 구문을 사용하여 시작됩니다.
* <% }) %>는 forEach 루프에서 수행할 작업을 끝내고 루프의 끝을 표시합니다.
* 루프 내부에서는 item을 이용하여 배열의 각 요소에 대해 작업을 수행할 수 있습니다.
* 루프가 끝나면 템플릿 엔진은 루프 이후의 코드를 계속 실행합니다.
예를 들어, 아래와 같은 코드가 있다고 가정해봅시다:
ejs

Copy code
<% const fruits = ['apple', 'banana', 'cherry']; %> <ul> <% fruits.forEach(fruit => { %> <li><%= fruit %></li> <% }) %> </ul>
이 코드에서 <% }) %>는 fruits 배열의 forEach 루프의 끝을 나타냅니다. 이 루프는 배열의 각 요소(예: 'apple', 'banana', 'cherry')에 대해 <li><%= fruit %></li> 코드를 실행하여 <ul> 요소 내에 <li> 요소를 생성합니다. </ul>은 목록을 닫는 태그입니다.
요약하자면, <% }) %>는 EJS 템플릿 엔진에서 forEach와 같은 제어 구조의 끝을 나타내는 구문입니다.

 

script는 body 안에 넣어야 해 body 밖에 넣어야 해?

ChatGPT
ChatGPT

<script> 태그는 일반적으로 HTML 파일의 <body> 요소 안에 넣거나 <head> 요소 안에 넣을 수 있습니다. 각각의 위치에 따라 스크립트가 실행되는 타이밍이 다릅니다.
1. <body> 요소 안에 넣을 경우:
    * 스크립트는 페이지의 요소들이 모두 로드된 후에 실행됩니다.
    * 페이지의 DOM이 모두 완성되었기 때문에 스크립트에서 HTML 요소를 안전하게 조작할 수 있습니다.
    * 이 경우 스크립트의 DOMContentLoaded 이벤트 리스너는 페이지 로드 완료 후 실행됩니다.
2. <head> 요소 안에 넣을 경우:
    * 스크립트는 페이지의 요소들이 로드되기 전에 실행됩니다.
    * 이 위치에 스크립트를 넣으면 HTML 요소가 아직 로드되지 않았을 수 있어 조작하려는 요소를 찾을 수 없을 수 있습니다.
    * 스크립트에서 HTML 요소를 조작하려면 DOMContentLoaded 이벤트를 사용하여 페이지 로드가 완료된 후 실행되도록 설정해야 합니다.
추천 방법
일반적으로 스크립트를 <body> 요소의 끝 부분에 넣는 것이 좋습니다. 이렇게 하면 페이지의 DOM 요소들이 모두 로드된 후 스크립트가 실행되어 오류를 최소화할 수 있습니다.
예를 들어, 아래와 같이 <body> 요소의 끝 부분에 스크립트를 넣습니다:
html

Copy code
<body> <!-- HTML 내용 --> <div>Content goes here</div> <!-- 스크립트는 body의 끝 부분에 넣습니다 --> <script> // 스크립트 내용 console.log('Hello, world!'); </script> </body>
이 위치에 스크립트를 두면 스크립트가 실행될 때 HTML 요소들이 모두 로드되어 있어서 스크립트가 요소들을 조작할 수 있습니다.

 

 

 

GetUser : request : [object Object]
[Nest] 34005  - 2024. 04. 25. 오후 11:59:50   ERROR [ExceptionsHandler] Cannot read properties of undefined (reading 'user_id')
TypeError: Cannot read properties of undefined (reading 'user_id')
    at VisionController.certificateImageCategory (/Users/_woo_s.j/Desktop/workspace/earth-marvel/src/vision/vision.controller.ts:36:25)
    at /Users/_woo_s.j/Desktop/workspace/earth-marvel/node_modules/@nestjs/core/router/router-execution-context.js:38:29
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
[Nest] 34005  - 2024. 04. 26. 오전 12:00:00     LOG [SchedulerService] Initialize to-do authentication
query: SELECT `task`.`task_id` AS `task_task_id`, `task`.`todo` AS `task_todo`, `task`.`start_date` AS `task_start_date`, `task`.`created_at` AS `task_created_at`, `task`.`updated_at` AS `task_updated_at`, `task`.`auth_sum` AS `task_auth_sum`, `task`.`auth_date` AS `task_auth_date`, `task`.`auth_yn` AS `task_auth_yn`, `task`.`check_yn` AS `task_check_yn`, `task`.`plannerId` AS `task_plannerId` FROM `task` `task` WHERE ? between `task`.`start_date` and task.end_date -- PARAMETERS: ["2024-04-26"]
query failed: SELECT `task`.`task_id` AS `task_task_id`, `task`.`todo` AS `task_todo`, `task`.`start_date` AS `task_start_date`, `task`.`created_at` AS `task_created_at`, `task`.`updated_at` AS `task_updated_at`, `task`.`auth_sum` AS `task_auth_sum`, `task`.`auth_date` AS `task_auth_date`, `task`.`auth_yn` AS `task_auth_yn`, `task`.`check_yn` AS `task_check_yn`, `task`.`plannerId` AS `task_plannerId` FROM `task` `task` WHERE ? between `task`.`start_date` and task.end_date -- PARAMETERS: ["2024-04-26"]
error: Error: Unknown column 'task.end_date' in 'where clause'
[Nest] 34005  - 2024. 04. 26. 오전 12:00:00   ERROR [Scheduler] QueryFailedError: Unknown column 'task.end_date' in 'where clause'

 

오류 원인을 미친 디테일로 설명하고 해결 방법을 알려드리겠습니다.
오류 원인 분석
1. Cannot read properties of undefined (reading 'user_id')
    * VisionController.certificateImageCategory 함수에서
    @GetUser() 데코레이터를 통해 request 객체에서 user 객체를 가져오는 부분에서 오류가 발생하고 있습니다.
    * 이 오류는 user 객체가 undefined로 추출되었거나,
    user 객체에서 user_id 속성에 접근하려고 했지만 user 객체가 undefined라서 발생합니다.
    * @GetUser() 데코레이터가 예상한 대로 request 객체에서 user 객체를
    제대로 추출하지 못하고 있는 것 같습니다.
2. QueryFailedError: Unknown column 'task.end_date' in 'where clause'
    * task 테이블에서 end_date 열이 존재하지 않거나, 열 이름이 잘못되어 쿼리가 실패하고 있습니다.
    * 이 오류는 쿼리를 실행할 때 task.end_date 열을 포함하여 WHERE 절을 사용하고 있는데,
    해당 열이 테이블에 존재하지 않기 때문에 발생합니다.
해결 방법
1. user_id 오류 해결
    * @GetUser() 데코레이터가 예상대로 request 객체에서 user 객체를 추출하지 못한 것으로 보입니다.
    * request 객체 구조를 확인하여 @GetUser() 데코레이터가 제대로 user 객체를 추출하고 있는지 확인하세요.
    * GetUser() 데코레이터의 로직을 검토하여 user 객체를 올바르게 추출하도록 수정하거나,
    user 객체를 올바르게 전달할 수 있는 방법을 확인하세요.
2. task.end_date 열 오류 해결
    * task 테이블에 end_date 열이 존재하는지 확인하세요.
    * 테이블에 end_date 열이 존재하지 않는 경우, 데이터베이스 구조를 수정하여
    task 테이블에 end_date 열을 추가하거나, 쿼리에서 task.end_date 열을 참조하는 부분을 수정하세요.
    * WHERE 절에서 열 이름이 잘못되었을 수 있으므로 열 이름을 확인하고 쿼리 로직을 수정하세요.
오류의 원인을 미친 디테일로 분석하고 해결 방법을 안내했습니다. 이를 참고하여 코드 수정과 쿼리 로직을 재검토해 주세요.