상세 컨텐츠

본문 제목

[yarn berry + husky] chalk 관련 에러 해결

기술

by 기먕로기 2023. 3. 10. 13:50

본문

상황

yarn berry가 적용된 프로젝트에 husky를 통한 pre-commit lint를 적용하려고 하다 에러가 발생하였다.

 

omg

Error: chalk tried to access #ansi-styles, but it isn't declared in its dependencies; this makes the require call ambiguous and unsound.

 

위와 같은 에러가 발생하였다

해결

solution

.yarnrc.yml에 위 내용을 추가하면 해결된다.

 

나 같은 경우는 구체적인 버전을 표기하지는 않았다.

...

packageExtensions:
  chalk@*:
    dependencies:
      "#ansi-styles": npm:ansi-styles@*
      "#supports-color": npm:supports-color@*

위 내용을 추가한 후 yarn에 적용시킨다.

 

$ yarn

 

이후 잘 작동하는 것을 확인할 수 있다.

 

해결

Ref.

https://github.com/chalk/chalk/issues/531

관련글 더보기

댓글 영역