들어가며
개발 작업을 완료하여 git origin push
를 하였는데 스크립트가 돌아가다가 갑자기 에러가 발생했다.
에러가 발생하길래 git config
나 remote url
혹은 authrity
쪽으로 생각했는데 에러 로그를 보니 한번도 못봤던 에러였다.
에러 내용은 error TS2688: Cannot find type definition file
으로, lint
관련된 에러로 보인다.
에러 발생 현상
1.branch
를 origin
에 push
를 시도하였다.
git push origin branch-name
2.lint
스크립트 동작package.json
의 lint
스크립트가 동작하기 시작하였다.
# 동작된 스크립트 내용
> 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
를 시도하니 정상적으로 동작하였다.
터미널 초기화 되는 부분은 시간되면 해결해봐야겠다. 자꾸 문제가 발생되서 번거롭다.
'프론트엔드 > 트러블 슈팅' 카테고리의 다른 글
터미널 - SSH 변경 접속시 에러 처리 방법 (0) | 2023.02.13 |
---|---|
npm start 시 loader.js 에서 throw err 가 발생하는 현상 해결 (0) | 2023.01.31 |
MacOS/맥북/M1 - node 가 정상적으로 동작하지 않는 현상 (0) | 2023.01.30 |
MacOS/맥북/M1 - HomeBrew 설치 후 brew 명령어를 찾을 수 없는 문제 해결 (zsh: command not found: brew) (0) | 2023.01.27 |
타입스크립트를 설치해도 tsc 명령어가 동작하지 않는 현상 해결 (0) | 2023.01.26 |