git push origin 할때 `error TS2688: Cannot find type definition file` lint 에러가 발생한 현상

반응형

들어가며

개발 작업을 완료하여 git origin push 를 하였는데 스크립트가 돌아가다가 갑자기 에러가 발생했다.

에러가 발생하길래 git configremote url 혹은 authrity 쪽으로 생각했는데 에러 로그를 보니 한번도 못봤던 에러였다.

에러 내용은 error TS2688: Cannot find type definition file 으로, lint 관련된 에러로 보인다.

에러 발생 현상

1.branchoriginpush 를 시도하였다.

git push origin branch-name

2.lint 스크립트 동작
package.jsonlint 스크립트가 동작하기 시작하였다.

# 동작된 스크립트 내용
> tsc && npm run eslint
# package.json 에 작성된 스크립트
"scripts": {
    ...
    "lint": "tsc && npm run eslint"
    ...
}

3.에러 발생

error TS2688: Cannot find type definition file 에러 발생

error TS2688: Cannot find type definition file for 'ace 2'.
  The file is in the program because:
    Entry point for implicit type library 'ace 2'

error TS2688: Cannot find type definition file for 'babel__core 2'.
  The file is in the program because:
    Entry point for implicit type library 'babel__core 2'

error TS2688: Cannot find type definition file for 'body-parser 2'.
  The file is in the program because:
    Entry point for implicit type library 'body-parser 2'

... 생략 ...

npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! develop-project lint: `tsc && npm run eslint`

해결 사항

우선 기존의 lint 는 정상적으로 동작하였고, lint 관련한 패키지 변경 내용도 없었다.
아마도 최근 포맷 이후 발생하는 부팅시 터미널 환경이 제멋대로 설정되는 부분에서 발생한 게 원인같다.

터미널 환경 해결은 차후 해결하고 우선 발생한 에러부터 처리하자

1.설치되었던 node_modules 제거

rm -rf node_modules

제거가 되었다면 2로 넘어가자.

나의 경우 에러가 발생했다. 에러 내용은 다음과 같다.
Permission 이라는 것으로 봐선 권한 관련 내용인것 같다.

npm clean rm: node_modules: Permission denied

1-2.권한을 주고 삭제 재시도

sudo rm -rf node_modules

권한을 주니 잘 삭제되었다.

2.npm cache를 초기화

npm cache clean -f

3.npm 재설치

npm ci

package.json 의 버전을 훼손하지 않고 node_modules 를 설치하는 명령어다.

4.재설치 완료

정상적으로 초기화 후 재설치하였다.
git push origin branch-name 으로 다시 push 를 시도하니 정상적으로 동작하였다.
터미널 초기화 되는 부분은 시간되면 해결해봐야겠다. 자꾸 문제가 발생되서 번거롭다.

반응형