[Error⚠️] error Running this command will add the dependency to the workspace root rather than the workspace itself, which might not be what you want ...

BinaryWoo_dev·2023년 3월 28일
0

error

목록 보기
1/2

내용

error Running this command will add the dependency to the workspace root rather than the workspace 
itself, which might not be what you want - if you really meant it, make it explicit by running this 
command again with the -W flag (or --ignore-workspace-root-check).

해석 : 이 명령을 실행하면 작업 공간이 아닌 작업 공간 루트에 종속성이 추가될 것이며, 당신이 원하는 결과가 아닐 수도 있습니다.

원인

  • 하위 workspace인 client 또는 server 에서가 아닌 root workspace에서 패키지를 설치하려고 하면 위와 같은 에러 메세지가 출력된다.
  • 그래서 $yarn add --dev typescript 명령어를 실행하려는 path 를 확인해보니 client 가 아닌 루트 path인 것을 확인할 수 있었다.

솔루션

  • 따라서, $cd client 명령어로 하위 workspace인 client 폴더로 이동한 후, 다시 $yarn install --dev typescript 명령어를 실행하였더니 패키지가 정상적으로 설치되었음을 확인할 수 있었다.

결론

  • workspace 가 따로 나눠져 있는 프로젝트인 경우, 패키지를 설치하려는 경로를 잘 확인하자
profile
매일 0.1%씩 성장하는 Junior Web Front-end Developer 💻🔥

0개의 댓글