티스토리 뷰
ubuntu 20.04 환경에서 npm install -g
을 하다 아래와 같은 에러 발생
npm ERR! code EACCES
npm ERR! syscall mkdir
npm ERR! path /usr/lib/node_modules/<package-name>
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, mkdir '/usr/lib/node_modules/<package-name>
mkdir 외에도 symlink로도 발생함
✨ 해결방법
global로 npm 패키지를 설치하다 보면 생기는 권한 이슈로 gloabl 패키지 설치 디렉토리를 홈 디렉토리에 생성한다
mkdir ~/.npm-global
npm config set prefix '~/.npm-global'
export PATH=~/.npm-global/bin:$PATH
source ~/.profile
위 명령어를 모두 입력해주고 다시 설치해주면 잘 실행 되는 것을 볼 수 있다
출처 : https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally
Resolving EACCES permissions errors when installing packages globally | npm Docs
Documentation for the npm registry, website, and command-line interface
docs.npmjs.com
'Error' 카테고리의 다른 글
[Linux] systemctl : failed to connect to bus (0) | 2022.08.17 |
---|---|
[mac/brew] Error: Your Command Line Tools are too outdated. (0) | 2022.03.08 |
[npm] npm install error : code ERESOLVE ERESOLVE could not resolve (0) | 2022.03.08 |
댓글