vercel 배포 중 mime 관련 오류

Zinny·2024년 4월 2일
0

error

목록 보기
2/2

Vercel 배포 시, building 중 MIME 관련 오류

오류 상황

package.json을 수정할 상황이 있어서 수정했다가 에러가 발생했다.
-> 특정 패키지를 package.json으로 삭제하고 yarn install으로 재설치하려던 상황...
-> 패키지 삭제는 패키지 매니저 명령어를 통해 하도록 하자.

오류 코드

error TS2688: Cannot find type definition file for 'mime'.
  The file is in the program because:
    Entry point for implicit type library 'mime'
error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Error: Command "yarn run build" exited with 2

mime에 관려된 타입을 찾을 수 없다는 에러이다.

해결 과정

1. package.json을 원상복귀 후 재배포

실패. 여전히 오류 발생

2. yarn add @types/mime --dev 로 mime 패키지를 설치해 타입 정의 파일을 설정해준다.

실패. tsconfing.json 파일에서 mime의 타입에 대한 설정을 명시적으로 지정해줘야한다.

3. tsconfing.json 설정 변경

배포 성공.

"compilerOptions": {
    ...
    "typesRoot": ["node_modules/@types"],
    ...
  },

위 코드를 추가해준다.

4. 추가적인 방법

  • yarn remove mime yarn add mime로 재설치

https://stackoverflow.com/questions/54232428/cannot-find-type-definition-file-for-node-in-typescript-react-app

profile
Studying for Frontend

0개의 댓글