mac npm 권한 에러 해결
npm EACCES 에러, sudo 없이 깔끔하게 해결함.
npm install 할 때 EACCES 에러 나면 짜증남. sudo 쓰기 싫을 때 이렇게 함.
mkdir ~/.npm-global
글로벌 npm 패키지 설치할 폴더 만듦.
npm config set prefix '~/.npm-global'
npm이 이 폴더 쓰도록 설정.
export PATH=~/.npm-global/bin:$PATH
쉘 PATH에 이 폴더 추가. 바로 적용됨.
이거 재부팅해도 유지되게 하려면 ~/.zshrc나 ~/.bash_profile 같은 쉘 설정 파일에 위 export 라인 추가하면 끝.
참고: stackoverflow
여기서 배울 것
- npm 글로벌 패키지 설치 경로 변경
- `npm config set prefix` 사용법
- 쉘 PATH 환경변수 영구 설정
원본 파일 보기 (.claude/skills/tn-mac-npm-permission-fix/SKILL.md)
---
name: Mac npm 권한 문제 해결
description: Use when the user encounters permission errors with npm on macOS, such as 'EACCES' errors when installing global packages, and needs a solution to fix npm permissions without using `sudo`.
version: 1.0.0
source: /home/son/prj/resume/backup_notes_260317/notion/Tech Note/mac 권한 문제 해결법 62d4de43c2734d0ca5e425bcdf158407.md
---
# mac 권한 문제 해결법
[https://stackoverflow.com/questions/16151018/how-to-fix-npm-throwing-error-without-sudo/16151707#16151707](https://stackoverflow.com/questions/16151018/how-to-fix-npm-throwing-error-without-sudo/16151707#16151707)
