오류 상황
필자의 경우
{
"include": ["src"],
"compilerOptions": {
"target": "ESNext"
}
}
compilerOptions의 target을 ESNext로 변경한 이후로
오류가 발생하였다.
- 오류 출력
node_modules/@types/node/globals.d.ts:6:76 - error TS2792: Cannot find module 'undici-types'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option?
6 type _Request = typeof globalThis extends { onmessage: any } ? {} : import("undici-types").Request;
~~~~~~~~~~~~~~
node_modules/@types/node/globals.d.ts:7:77 - error TS2792: Cannot find module 'undici-types'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option?
7 type _Response = typeof globalThis extends { onmessage: any } ? {} : import("undici-types").Response;
~~~~~~~~~~~~~~
node_modules/@types/node/globals.d.ts:8:77 - error TS2792: Cannot find module 'undici-types'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option?
8 type _FormData = typeof globalThis extends { onmessage: any } ? {} : import("undici-types").FormData;
~~~~~~~~~~~~~~
node_modules/@types/node/globals.d.ts:9:76 - error TS2792: Cannot find module 'undici-types'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option?
9 type _Headers = typeof globalThis extends { onmessage: any } ? {} : import("undici-types").Headers;
~~~~~~~~~~~~~~
node_modules/@types/node/globals.d.ts:10:81 - error TS2792: Cannot find module 'undici-types'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option?
10 type _MessageEvent = typeof globalThis extends { onmessage: any } ? {} : import("undici-types").MessageEvent;
~~~~~~~~~~~~~~
node_modules/@types/node/globals.d.ts:12:14 - error TS2792: Cannot find module 'undici-types'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option?
12 : import("undici-types").RequestInit;
~~~~~~~~~~~~~~
node_modules/@types/node/globals.d.ts:14:14 - error TS2792: Cannot find module 'undici-types'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option?
14 : import("undici-types").ResponseInit;
~~~~~~~~~~~~~~
node_modules/@types/node/globals.d.ts:15:78 - error TS2792: Cannot find module 'undici-types'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option?
15 type _WebSocket = typeof globalThis extends { onmessage: any } ? {} : import("undici-types").WebSocket;
~~~~~~~~~~~~~~
node_modules/@types/node/globals.d.ts:16:80 - error TS2792: Cannot find module 'undici-types'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option?
16 type _EventSource = typeof globalThis extends { onmessage: any } ? {} : import("undici-types").EventSource;
~~~~~~~~~~~~~~
node_modules/@types/node/globals.d.ts:548:25 - error TS2792: Cannot find module 'undici-types'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option?
548 : typeof import("undici-types").Request;
~~~~~~~~~~~~~~
node_modules/@types/node/globals.d.ts:557:25 - error TS2792: Cannot find module 'undici-types'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option?
557 : typeof import("undici-types").Response;
~~~~~~~~~~~~~~
node_modules/@types/node/globals.d.ts:564:25 - error TS2792: Cannot find module 'undici-types'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option?
564 : typeof import("undici-types").FormData;
~~~~~~~~~~~~~~
node_modules/@types/node/globals.d.ts:571:25 - error TS2792: Cannot find module 'undici-types'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option?
571 : typeof import("undici-types").Headers;
~~~~~~~~~~~~~~
node_modules/@types/node/globals.d.ts:581:25 - error TS2792: Cannot find module 'undici-types'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option?
581 : typeof import("undici-types").MessageEvent;
~~~~~~~~~~~~~~
node_modules/@types/node/globals.d.ts:585:25 - error TS2792: Cannot find module 'undici-types'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option?
585 : typeof import("undici-types").WebSocket;
~~~~~~~~~~~~~~
node_modules/@types/node/globals.d.ts:594:25 - error TS2792: Cannot find module 'undici-types'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option?
594 : typeof import("undici-types").EventSource;
~~~~~~~~~~~~~~
node_modules/@types/node/http.d.ts:1909:29 - error TS2792: Cannot find module 'undici-types'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option?
1909 const WebSocket: import("undici-types").WebSocket;
~~~~~~~~~~~~~~
node_modules/@types/node/http.d.ts:1913:30 - error TS2792: Cannot find module 'undici-types'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option?
1913 const CloseEvent: import("undici-types").CloseEvent;
~~~~~~~~~~~~~~
node_modules/@types/node/http.d.ts:1917:32 - error TS2792: Cannot find module 'undici-types'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option?
1917 const MessageEvent: import("undici-types").MessageEvent;
~~~~~~~~~~~~~~
tsconfig.json:5:5 - error TS5025: Unknown compiler option 'skibLibCheck'. Did you mean 'skipLibCheck'?
5 "skibLibCheck": "true"
~~~~~~~~~~~~~~
오류원인은 @types 버전이 20 버전 이상으로 업데이트되면서 undici-types 모듈을 찾을 수 없다는 오류가 발생하고 있는 것으로 보인다.
해결방법
tsconfig.ts파일에 "skipLibCheck": true, 를 추가해 주면 된다!
{
"include": ["src"],
"compilerOptions": {
"skipLibCheck": true,
"target": "ESNext"
}
}
- tsconfig.ts파일 생성방법
tsconfig.ts파일 생성방법은 터미널에 아래 명령어를 입력해 주면 생성됨.
tsc --init