강의

멘토링

로드맵

Inflearn brand logo image

Inflearn Community Q&A

nextdev's profile image
nextdev

asked

Bite-sized TypeScript

Getting Started with TypeScript React

npx create-react-app 실행했을 때 오류 해결 방법

Resolved

Written on

·

403

·

Edited

0

Need to install the following packages:
create-react-app@5.0.1
Ok to proceed? (y) 

npm error code EACCES
npm error syscall mkdir
npm error path /Users/hello/.npm/_cacache/index-v5/e6/e7
npm error errno EACCES
npm error
npm error Your cache folder contains root-owned files, due to a bug in
npm error previous versions of npm which has since been addressed.
npm error
npm error To permanently fix this problem, please run:
npm error   sudo chown -R 501:20 "/Users/hello/.npm"
npm error A complete log of this run can be found in: /Users/hello/.npm/_logs/2024-12-10T01_00_27_100Z-debug-0.log

위와 같은 오류가 발생하시는 분들은 아래 방법으로 해결할 수 있습니다.

 

npm 캐시 권한 문제 해결 방법

npm 캐시 폴더의 소유권 수정 후 실행하기

sudo chown -R $(whoami) ~/.npm
npm install -g create-react-app
npx create-react-app .

or

캐시를 완전히 정리 후 실행하기

npm cache clean --force
npm install -g create-react-app
npx create-react-app .
typescript

Answer 1

0

안녕하세요, 인프런 AI 인턴입니다. Next님.

리액트 프로젝트 생성 시 발생하는 EACCES 권한 오류에 대한 해결 방법을 안내드립니다. 이 오류는 NPM 캐시 폴더 내 파일 소유 권한이 현재 사용자가 아닌 root 사용자에게 있기 때문에 발생합니다. 아래 해결 방법을 참고하시면 문제를 해결하실 수 있습니다:

해결 방법:

  1. 폴더 소유권 변경:

    • 현재 사용자에게 .npm 디렉토리 소유권을 부여합니다. 이 명령어는 권한을 설정하여 제한 없이 실행할 수 있도록 해줍니다.
    sudo chown -R $(whoami) ~/.npm
    
  2. npm 캐시 정리:

    • npm 캐시를 초기화하여 문제가 발생할 수 있는 잠재적 오류를 방지합니다.
    npm cache clean --force
    
  3. 글로벌 설치 및 리액트 앱 생성:

    • 전역적으로 create-react-app 설치 후, 프로젝트를 생성합니다.
    npm install -g create-react-app
    npx create-react-app .
    

추가 참고 링크

해당 방법을 통해 문제를 해결할 수 있을 것이라고 생각합니다. 권한 문제는 NPM 설치 및 사용 시 발생하는 일반적인 문제로, 위 해결책들은 프로세스를 원활하게 진행하는 데 도움을 줄 것입니다.

저는 질문자님의 이해를 돕고자 지식공유자님의 기존 답변을 참고하여 유사한 답변 링크를 추천해드리고 있습니다. 현재 베타 기능으로 답변이 만족스럽지 않을 수 있는 점 양해 부탁드립니다. 🙏 추가적으로 궁금한 점이 있으시면, 이어서 질문해 주세요. 곧 지식공유자께서 답변해 주실 것입니다.

nextdev's profile image
nextdev

asked

Ask a question