본문 바로가기

🌼 TIL

🌞 1/18 내배캠 React 57일차 [typescript]

[ Typescript ]

 

[ 트러블 슈팅 ] Typescript


문제 : jsx파일을 tsx파일로 변환하는 중 ‘ —jsx ’ 플래그를 제공하지 않으면 JSX를 사용할 수 없습니다 오류

tsconfig.json 파일에서의 설정이 부족해서 생긴 에러

 

🛠 해결

→ tsconfig.json에 “jsx”: “react 를 입력해주면 된다.

 

 

→ 에러 해결


[ 트러블 슈팅 ] Typescript

npm install -g ts-node 시에

npm ERR! code EACCES
npm ERR! syscall mkdir
npm ERR! path /usr/local/lib/node_modules/ts-node
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/ts-node'
npm ERR!  [Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/ts-node'] {
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'mkdir',
npm ERR!   path: '/usr/local/lib/node_modules/ts-node'
npm ERR! }
npm ERR! 
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR! 
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/imjaeyeong/.npm/_logs/2023-01-17T02_26_34_375Z-debug-0.log

라는 에러가 떴다.

아마 global install폴더에 문제가 있는듯하다.

 

 ⛔ 방법 2가지

  1. sudo를 통해 강제로 설치하기 sudo npm install -g ts-node 입력
  2. global install 폴더를 홈 디렉토리 내부로 변경
$ mkdir ~/.npm-global

$ npm config set prefix ~/.npm-global

export PATH=~/.npm-global/bin:$PATH

 

추가로 배운 것

 

toLowerCase 메서드 : 대문자를 소문자로 바꾸는 메서드 이다.

toUpperCase 메서드 : 소문자를 대문자로 바꾸는 메서드 이다.

바인딩 Binding : ‘묶다’라는 사전적 의미가 담겨있다

프로그램의 어떤 기본다위가 가질 수 있는 구성요소의 구체적인 값, 성격을 확정하는 것

두 데이터 혹은 정보의 소스를 일치시키는 (묶는) 기법

int num = 123

여기서 num, int, 123 을 각각 이름, 자료형, 자료값 이라는 구체적인 값을 할당하는 각각의 과정을

바인딩 이라고한다

참고 : 

https://velog.io/@zinukk/%EB%B0%94%EC%9D%B8%EB%94%A9