study/Headache
Mac에서 npm 설치시 permission error
salalsksjwnn
2023. 4. 10. 23:04
728x90
맥에 npm을 설치하려고 보니 에러가 떴다
IMac-HNJN:~ HNJN$ npm install -g @vue/cli
npm notice
npm notice New minor version of npm available! 9.5.0 -> 9.6.4
npm notice Changelog: https://github.com/npm/cli/releases/tag/v9.6.4
npm notice Run npm install -g npm@9.6.4 to update!
npm notice
npm ERR! code EACCES
npm ERR! syscall mkdir
npm ERR! path /usr/local/lib/node_modules/@vue
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/@vue'
npm ERR! [Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/@vue'] {
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'mkdir',
npm ERR! path: '/usr/local/lib/node_modules/@vue'
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/HNJN 1/.npm/_logs/2023-04-10T13_40_59_461Z-debug-0.log
npm ERR! Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/@vue'
'usr/local/... 에서 permission이 거부됐다고 한다. 내 컴퓨터의 이름은 HNJN으로 되어있는데 아마 폴더 이름도 HNJN이지 않을까 usr가 아니라?
sudo를 사용해 설정해주고
sudo chown -R $(whoami) $(npm config get prefix)/{lib/node_modules,bin,share}
비밀번호를 입력하라고 하면 입력한다.
그리고 다시 설치
npm install -g @vue/cli
끝
728x90