티스토리 뷰
Typescript 개발환경을 세팅하고 기본적인 Hello World!를 출력하려고 하는데 오류가 생긴다.
PS C:\RN_Project\src> ts-node .\index.ts
C:\Scoop\persist\nodejs-lts\bin\node_modules\ts-node\src\index.ts:693
return new TSError(diagnosticText, diagnosticCodes);
^
TSError: ⨯ Unable to compile TypeScript:
index.ts:1:1 - error TS2584: Cannot find name 'console'. Do you need to change your target library? Try changing the 'lib' compiler option to include 'dom'.
1 console.log("Hello World!");
~~~~~~~
at createTSError (C:\Scoop\persist\nodejs-lts\bin\node_modules\ts-node\src\index.ts:693:12)
at reportTSError (C:\Scoop\persist\nodejs-lts\bin\node_modules\ts-node\src\index.ts:697:19)
at getOutput (C:\Scoop\persist\nodejs-lts\bin\node_modules\ts-node\src\index.ts:884:36)
at Object.compile (C:\Scoop\persist\nodejs-lts\bin\node_modules\ts-node\src\index.ts:1186:30)
at Module.m._compile (C:\Scoop\persist\nodejs-lts\bin\node_modules\ts-node\src\index.ts:1310:30)
at Module._extensions..js (internal/modules/cjs/loader.js:1101:10)
at Object.require.extensions.<computed> [as .ts] (C:\Scoop\persist\nodejs-lts\bin\node_modules\ts-node\src\index.ts:1314:12)
at Module.load (internal/modules/cjs/loader.js:937:32)
at Function.Module._load (internal/modules/cjs/loader.js:778:12)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12) {
diagnosticText: "\x1B[96mindex.ts\x1B[0m:\x1B[93m1\x1B[0m:\x1B[93m1\x1B[0m - \x1B[91merror\x1B[0m\x1B[90m TS2584: \x1B[0mCannot find name 'console'. Do you need to change your target library? Try changing the 'lib' compiler option to include 'dom'.\r\n" +
'\r\n' +
'\x1B[7m1\x1B[0m console.log("Hello World!");\r\n' +
'\x1B[7m \x1B[0m \x1B[91m~~~~~~~\x1B[0m\r\n',
diagnosticCodes: [ 2584 ]
}
아래와 같이 npm으로 추적으로 설치를 해주니 정상적으로 출력.
PS C:\RN_Project\src> npm install @types/node --save-dev
npm WARN saveError ENOENT: no such file or directory, open 'C:\RN_Project\src\package.json'
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN enoent ENOENT: no such file or directory, open 'C:\RN_Project\src\package.json'
npm WARN src No description
npm WARN src No repository field.
npm WARN src No README data
npm WARN src No license field.
+ @types/node@16.6.1
added 1 package from 43 contributors and audited 1 package in 1.671s
found 0 vulnerabilities
PS C:\RN_Project\src> ts-node .\index.ts
Hello World!
'개발' 카테고리의 다른 글
Flutter 개발 환경 설정 시 'cmdline-tools component is missing' 오류 (0) | 2024.08.21 |
---|---|
React 프로젝트 생성 방법 변화 (0) | 2024.08.20 |
[전자정부프레임워크] 메이븐 동기화 오류때 확인할 내용 (0) | 2019.09.08 |
[안드로이드] Ubuntu에 Android Studio 설치 (0) | 2017.02.01 |
듀얼부팅 태블릿 - 태크라스트 x80 개봉기 (0) | 2016.11.17 |
- Total
- Today
- Yesterday
- 자바
- 보안
- 개봉기
- 책
- DB2
- 개발자
- Eclipse
- 설치
- tomcat
- 톰캣
- 오라클
- 데이터베이스
- 오픈소스
- 기사
- Java
- 시험
- 개발
- apache
- db
- 우분투
- centos
- Linux
- 윈도우
- 설정
- 리눅스
- mac os
- VirtualBox
- IBM
- 안드로이드
- ubuntu
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 |