tsc 명령어를 실행하면 cannot find module undici-type 이라는 오류가 뜹니다.
tsc 명령어를 입력하면 아래와 같은 오류가 발생하는데 js 파일은 정상적으로 만들어집니다.어떤게 이상한걸까요? undici-types 라는 모듈은 설치한적도 없고 사용한적도 없는데 왜 이런 오류가 뜨는지 모르겠습니다...PS C:\typescript\typescript_section2> tsc
node_modules/@types/node/globals.d.ts:325:84 - 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?
325 type _Request = typeof globalThis extends { onmessage: any } ? {} : import("undici-types").Request;
~~~~~~~~~~~~~~
node_modules/@types/node/globals.d.ts:326:85 - 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?
326 type _Response = typeof globalThis extends { onmessage: any } ? {} : import("undici-types").Response;
~~~~~~~~~~~~~~
node_modules/@types/node/globals.d.ts:327:85 - 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?
327 type _FormData = typeof globalThis extends { onmessage: any } ? {} : import("undici-types").FormData;
~~~~~~~~~~~~~~
node_modules/@types/node/globals.d.ts:328:84 - 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?
328 type _Headers = typeof globalThis extends { onmessage: any } ? {} : import("undici-types").Headers;
~~~~~~~~~~~~~~
node_modules/@types/node/globals.d.ts:330:22 - 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?
330 : import("undici-types").RequestInit;
~~~~~~~~~~~~~~
node_modules/@types/node/globals.d.ts:336:35 - 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?
336 type RequestInfo = import("undici-types").RequestInfo;
~~~~~~~~~~~~~~
node_modules/@types/node/globals.d.ts:337:35 - 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?
337 type HeadersInit = import("undici-types").HeadersInit;
~~~~~~~~~~~~~~
node_modules/@types/node/globals.d.ts:338: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?
338 type BodyInit = import("undici-types").BodyInit;
~~~~~~~~~~~~~~
node_modules/@types/node/globals.d.ts:339:39 - 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?
339 type RequestRedirect = import("undici-types").RequestRedirect;
~~~~~~~~~~~~~~
node_modules/@types/node/globals.d.ts:340:42 - 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?
340 type RequestCredentials = import("undici-types").RequestCredentials;
~~~~~~~~~~~~~~
node_modules/@types/node/globals.d.ts:341:35 - 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?
341 type RequestMode = import("undici-types").RequestMode;
~~~~~~~~~~~~~~
node_modules/@types/node/globals.d.ts:342:38 - 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?
342 type ReferrerPolicy = import("undici-types").ReferrerPolicy;
~~~~~~~~~~~~~~
node_modules/@types/node/globals.d.ts:343:34 - 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?
343 type Dispatcher = import("undici-types").Dispatcher;
~~~~~~~~~~~~~~
node_modules/@types/node/globals.d.ts:344:37 - 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?
344 type RequestDuplex = import("undici-types").RequestDuplex;
~~~~~~~~~~~~~~
node_modules/@types/node/globals.d.ts:360:21 - 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?
360 : typeof import("undici-types").Request;
~~~~~~~~~~~~~~
node_modules/@types/node/globals.d.ts:367:21 - 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?
367 : typeof import("undici-types").Response;
~~~~~~~~~~~~~~
node_modules/@types/node/globals.d.ts:374:21 - 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?
374 : typeof import("undici-types").FormData;
~~~~~~~~~~~~~~
node_modules/@types/node/globals.d.ts:381:21 - 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?
381 : typeof import("undici-types").Headers;
~~~~~~~~~~~~~~
Found 18 errors in the same file, starting at: node_modules/@types/node/globals.d.ts:325
답변 2
1
안녕하세요 이정환입니다.
Node 20 버전을 사용하고 계실 경우 @types/node가 20버전으로 설치되지 않으면 해당 오류가 발생하는 걸로 보입니다. 다음 질문을 참고해보시면 해결하실 수 있을거에요!
강의 커리큘럼 관련 질문입니다.
0
56
1
61강(Context API)에서 TodoStateContext 질문
0
64
2
ReturnType에서 any와 never 사용의 차이가 있나요?
0
67
2
reject로 전달되는 값(거부 이유)의 타입과 타입 가드
0
89
2
리액트 타입스크립트 설정 시 에러
0
76
1
인덱스드 엑세스타입 실무질문
0
67
2
모든 ts파일이 컴파일 되지 않습니다.(해결됨.)
0
133
4
핸드북 light/dark mode 관련 이슈가 있는 것 같습니다.
0
82
1
제네릭 클래스 핸드북 페이지가 undefined라고 나옵니다.
0
85
2
적절한 타입 찾기 React.ChangeEvent<HTMLInputElemen>
0
92
2
outDir 옵션 추가 후 컴파일 오류 질문
0
211
1
호출 시그니처 질문
0
140
2
서로소 유니언 타입이 discriminated union과 동의어 인가요?
0
149
2
조건부타입소개 중 함수오버로딩 활용 시 인수의타입과 함수의 반환값의 타입이 깨지는 문제
0
118
1
할인쿠폰 관련하여
0
251
2
프론트엔드에서의 인터페이스활용
0
159
2
안녕하세요 이정환님!
0
132
1
Node.js 설치에 관한 질문입니다.
0
146
2
함수 타입 호출 시그니처
0
110
1
35강. 모듈 보강은 라이브러리 파일을 직접 편집해야 하나요?
0
114
2
인터페이스 문법이 있는데 타입 별칭 문법은 왜 있나요?
0
179
4
마우스 호버 시 정보
0
151
2
vite으로 리액트 빌드하기를 업데이트해주세요.
1
127
2
타입가드를 만들어 사용하는 이유가 궁금합니다.
0
152
2






