Ts 에러 메모장

정호재·2023년 3월 19일
0

Ts

목록 보기
1/5

에러

  • Cannot redeclare block-scoped variable 에러
    : 전역 변수로 선언되어 있는 변수명 사용 불가능

    .json에 아래 추가
    "compilerOptions": {
    "lib" : [ "ES2015"]
    },

    을 추가하면 해결된다고 함, 근데 전역변수로 선언되어 있는 이름은 다르게 바꿔주는게 나을듯

  • Cannot find name 'console'

    .json에 추가
    "compilerOptions": {
    "lib" : [ "DOM"]
    },

  • npm ERR! code E404
    npm ERR! 404 Not Found - GET https://skimdb.npmjs.com/registry/typescript/-/typescript-5.0.2.tgz - not_found
    npm ERR! 404
    npm ERR! 404 'typescript@https://skimdb.npmjs.com/registry/typescript/-/typescript-5.0.2.tgz' is not in this registry.
    npm ERR! 404
    npm ERR! 404 Note that you can also install from a
    npm ERR! 404 tarball, folder, http url, or git url.

    npm config set registry http://registry.npmjs.org/

==> 경로를 정상적으로 다시 설정해서 해결

선언한 type을 잘 이해하지 못 할때

  • sudo npm install -g typescript
  • tsc --init
    ==> 그냥 npm install 하면 안되고 권한적인 문제가 있을 것으로 추정된다는 오류 뜸--> sudo도 권한주면 설치가 됨
profile
공부 일기장

0개의 댓글