[개발 환경 설정] node_modules 제거 및 클린 설치 명령어 정리 (npm / yarn)

헤이안나·2025년 5월 26일
0

🧹

✅ 범용 명령어 (OS 무관, 가장 안전)

npx rimraf node_modules yarn.lock package-lock.json
yarn install
# 또는
npm install

✅ macOS / Linux 전용 (rm 사용 가능할 때)

rm -rf node_modules yarn.lock package-lock.json
yarn install
# 또는
npm install

✅ Yarn 전용 제거 및 재설치

rimraf node_modules yarn.lock       # 또는 npx rimraf ...
yarn install

✅ NPM 전용 제거 및 재설치

rimraf node_modules package-lock.json   # 또는 npx rimraf ...
npm install

✅ 참고: rimraf 사용하려면?

npm install -D rimraf      # 로컬 설치
# 또는
npm install -g rimraf      # 전역 설치

🧼 캐시까지 완전 초기화 (필요한 경우만)

yarn cache clean
npm cache clean --force
profile
리액트 공부하는 사람

0개의 댓글