>  Q&A  >  본문

"tsc" 명령을 표시할 때 "SyntaxError: 예기치 않은 토큰이 있습니까?"가 나타납니다.

<p>저는 TypeScript를 처음 사용합니다. <code>tsc filename.ts</code> 명령을 실행하여 typescript 파일을 javascript 파일로 변환해 보았습니다. 하지만 오류가 표시됩니다. </p> <pre class="brush:php;toolbar:false;">C:Program Files (x86)Nodistbinnode_modulestypescriptlibtsc.js:93 for (let i = startIndex ?? 0; i < array.length; i++) { ^ 구문 에러 : 예기치 않은 토큰? Module._compile (internal/modules/cjs/loader.js:749:23) Object.Module._extensions..js (internal/modules/cjs/loader.js:816:10) Module.load에서 (internal/modules/cjs/loader.js:672:32) tryModuleLoad(internal/modules/cjs/loader.js:612:12)에서 Function.Module._load(internal/modules/cjs/loader.js:604:3)에서 Module.require (internal/modules/cjs/loader.js:711:19) 필요 시(internal/modules/cjs/helpers.js:14:16) Object.<anonymous> (C:Program Files (x86)Nodistbinnode_modulestypescriptbintsc:2:1) Module._compile (internal/modules/cjs/loader.js:805:30) Object.Module._extensions..js (internal/modules/cjs/loader.js:816:10)</pre> <p>노드를 최신 버전으로 설치해 보았습니다. </p>
P粉026665919P粉026665919421일 전939

모든 응답(1)나는 대답할 것이다

  • P粉798343415

    P粉7983434152023-08-26 17:11:43

    TypeScript 5.1.6 및 Node 12.x 버전을 사용해도 동일한 문제가 발생했습니다.

    이 조합으로 인해 이런 문제가 발생하게 됩니다. 저는 4.9.5로 다운그레이드했는데 제게는 아주 잘 작동합니다. TypeScript

    아래 사진을 참고해주세요:

    https://www.typescriptlang.org /docs/handbook/release-notes/typescript-5-1.html

    회신하다
    0
  • 취소회신하다