• 카테고리

    질문 & 답변
  • 세부 분야

    데브옵스 · 인프라

  • 해결 여부

    미해결

프론트엔드 도커파일 실행 중 오류

24.01.15 12:27 작성 조회수 274

0

15.97 src/components/header/Header.tsx(1,8): error TS6133: 'React' is declared but

its value is never read.

15.97 src/components/header/Header.tsx(6,19): error TS6133: 'setIsLogin' is declare

d but its value is never read.

15.98 src/components/header/Header.tsx(9,9): error TS6133: 'border' is declared but

its value is never read.

15.99 src/components/htmlEditor/HtmlEditor.tsx(1,8): error TS6133: 'React' is decla

red but its value is never read.

15.99 src/components/htmlEditor/HtmlEditor.tsx(2,20): error TS7016: Could not find

a declaration file for module '@toast-ui/editor'. '/app/node_modules/@toast-ui/edit

or/dist/esm/index.js' implicitly has an 'any' type.

15.99 There are types at '/app/node_modules/@toast-ui/editor/types/index.d.ts', b

ut this result could not be resolved when respecting package.json "exports". The '@

toast-ui/editor' library may need to update its package.json or typings.

15.99 src/main.tsx(1,1): error TS6133: 'React' is declared but its value is never r

ead.

15.99 src/pages/myPage/MyPost.tsx(1,1): error TS6133: 'React' is declared but its v

alue is never read.

15.99 src/pages/post/ReadPage.tsx(1,8): error TS6133: 'React' is declared but its v

alue is never read.

15.99 src/pages/post/ReadPage.tsx(4,1): error TS6133: 'search' is declared but its

value is never read.

15.99 src/pages/post/ReadPage.tsx(8,19): error TS6133: 'setIsLogin' is declared but

its value is never read.

------

failed to solve: process "/bin/sh -c npm run build" did not complete successfully:

exit code: 2



이런 오류는 어떡하나요?

답변 1

답변을 작성해보세요.

0

인프런 AI 인턴님의 프로필

인프런 AI 인턴

2024.01.17

안녕하세요, 인프런 AI 인턴입니다. jacomyou님, TypeScript에서 발생한 오류는 불필요한 변수나 import된 모듈이 코드 내에서 사용되지 않아 나타나는 경우가 대부분입니다.

첫 번째로, ReactsetIsLogin, border 처럼 선언되었지만 사용되지 않는 변수들은 해당 파일에서 사용하지 않는 경우이니 코드 상에서 제거하시거나 주석 처리하여 오류를 해결할 수 있습니다.

두 번째로, '@toast-ui/editor' 모듈과 관련된 오류는 @toast-ui/editor 라이브러리의 타입 선언 파일을 찾지 못해서 발생하는 문제입니다. 이 경우는 해당 라이브러리의 타입 선언 파일이 존재하는지 확인하고, tsconfig.json"typeRoots" 또는 "paths"를 적절히 설정하여 해결할 수 있습니다.

또한, 패키지 관리자의 패키지 설치 문제로 인한 것일 수도 있으니 node_modules 폴더와 package-lock.json 또는 yarn.lock 파일을 삭제한 다음, npm install 또는 yarn install을 재실행해보는 것도 좋은 방법입니다.

마지막으로 failed to solve: process "/bin/sh -c npm run build" did not complete successfully: exit code: 2 오류는 위에 나열된 오류들로 인해 빌드 프로세스가 실패하여 나타난 것입니다. 따라서 위에서 언급한 오류들을 해결하면 빌드 프로세스도 정상적으로 완료될 가능성이 높습니다.

도움이 필요하다면 추가적인 정보가 담긴 Stack Overflow나 관련 커뮤니티에서 검색하거나, 더 자세한 안내를 원하신다면 관련 질문을 포럼이나 커뮤니티에 올려 도움을 받는 방법도 있습니다.