본문 바로가기
ERROR&BUG

[mac]npm install -g yarn 설치 시 Error

by 어쩌다개발 2022. 12. 27.
반응형

user@user-ui-MacBookPro ~ % npm install -g yarn
npm ERR! code EACCES
npm ERR! syscall mkdir
npm ERR! path /usr/local/lib/node_modules/yarn
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/yarn'
npm ERR!  [Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/yarn'] {
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'mkdir',
npm ERR!   path: '/usr/local/lib/node_modules/yarn'
npm ERR! }
npm ERR! 
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR! 
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/user/.npm/_logs/2022-12-27T07_21_02_393Z-debug-0.log

yarn을 설치하기 위해 npm install -g yarn 을 입력했는데 위와 같은 에러가 뜨는 경우 권한 문제로 인한거니 아래와 같이 sudo를 붙여서 입력해준다.

sudo npm install -g yarn

그러면 노트북 패스워드를 묻는 명령어가 나오고, 패스워드를 입력하면 잘 설치된다.

반응형

댓글