C.W.K.
Stream
Lesson 02 of 05 · published

Yarn Berry 설치 (프로젝트 별, Corepack 통해)

~9 min · yarn, installation, corepack

Level 0초심자
0 XP0/55 lessons0/16 achievements
0/80 XP to next level80 XP to go0% complete

Yarn Berry 는 npm 이나 pnpm 같이 글로벌 install 안 함. 권장 path 는 Corepack — Node.js 의 공식 패키지-매니저-버전-매니저 — 가 package.jsonpackageManager 필드에 핀된 정확한 버전으로 프로젝트 별 Yarn install. 'v3 가졌고 너는 v4, 우리 lockfile 갈라짐' 문제 제거.

corepack enable 이 shim 활성화. packageManager 필드 가진 프로젝트에서 처음 yarn 돌릴 때 Corepack 이 정확한 yarn 버전 다운로드. yarn init -2 가 새 Berry 프로젝트 부트스트랩 (-2 는 'Yarn 2+ 사용' 의미, 오늘은 Berry v4 의미). yarn set version stable 이 기존 프로젝트를 최신 stable Berry 로 전환.

프로젝트 없는 일회용에는 corepack prepare yarn@stable --activate 가 최신 yarn 글로벌 install — 프로젝트 밖에서 yarn 돌리는 데 유용하지만 매일 작업엔 unusual.

Code

Berry 프로젝트 부트스트랩·bash
# 1. Corepack 활성화 (머신 당 한 번)
corepack enable

# 2. Yarn Berry 로 새 프로젝트 만들기
mkdir my-app && cd my-app
yarn init -2

# 3. 프로젝트 이제 가짐:
#    "packageManager": "yarn@4.x.x" 의 package.json
#    .yarn/releases/yarn-4.x.x.cjs (yarn binary, commit 됨)
#    .yarnrc.yml (yarn 설정)
기존 프로젝트를 Berry 로 마이그레이션·bash
# 기존 프로젝트에서 최신 stable Berry 로 전환
yarn set version stable

# 그 다음 install
yarn install

# Yarn 이 .yarn/cache/, .pnp.cjs, .yarnrc.yml 작성 — 다 commit
# (zero-installs 원하면 .yarn/cache 도)

External links

Exercise

scratch Berry 프로젝트 부트스트랩: 'corepack enable && mkdir scratch && cd scratch && yarn init -2'. .yarn/ 디렉토리 봐 — commit 된 binary, 캐시 구조, yarnrc. Berry 의 '자기를 repo 에 install' 접근이 unusual; 이해하면 나머지 모델 unlock.

Progress

Progress is local-only — sign in to sync across devices.
이 페이지에서 버그를 발견하셨거나 피드백이 있으세요?문제 신고

댓글 0

🔔 답글 알림 (로그인 필요)
로그인댓글을 남기려면 로그인해 주세요.

아직 댓글이 없어요. 첫 댓글을 남겨보세요.