pnpm config

별칭: c

구성 파일들을 관리하기

pnpm 설정은 두 종류의 구성 파일로 나뉩니다:

  • Legacy and npm-compatible registry/authentication settings live in INI files: the global auth.ini file and local .npmrc files.
  • pnpm settings live in YAML files: the global config.yaml and the per-project pnpm-workspace.yaml. The global file may also hold the structured _auth and registries values that pnpm 12.1 and newer writes during pnpm login.

로컬 워크스페이스 설정 파일은 프로젝트 루트에 위치하며 이름은 pnpm-workspace.yaml입니다. 전역 YAML 설정 파일(config.yaml)의 위치는 다음과 같습니다:

  • If $PNPM_CONFIG_HOME is non-empty, then $PNPM_CONFIG_HOME/config.yaml
  • Otherwise, if the $XDG_CONFIG_HOME env variable is set, then $XDG_CONFIG_HOME/pnpm/config.yaml
  • Windows의 경우: ~/AppData/Local/pnpm/config/config.yaml
  • macOS의 경우: ~/Library/Preferences/pnpm/config.yaml
  • Linux의 경우: ~/.config/pnpm/config.yaml

The global auth.ini file uses the same directory. See Auth file locations.

You can also retrieve the path to your global config file by running:

pnpm config get globalconfig

Commands#

set <key> <value>#

Config key를 제공된 value로 설정하십시오.

--json 플래그가 없으면 값을 일반 문자열로 파싱합니다:

pnpm config set --location=project nodeVersion 22.0.0

--json 플래그가 있으면 값을 JSON으로 파싱합니다:

pnpm config set --location=project --json nodeVersion '"22.0.0"'

--json 플래그를 사용하면 pnpm config set으로 배열과 객체도 만들 수 있습니다:

pnpm config set --location=project --json allowBuilds '{"react": true, "react-dom": true}'
pnpm config set --location=project --json catalog '{ "react": "19" }'

set 명령은 속성 경로를 허용하지 않습니다.

pnpm config set refuses to write a setting to a project's pnpm-workspace.yaml that pnpm does not read from there, such as configDir, pnpmHomeDir, stateDir, and the other settings that name machine-level state. Since v12.1.0, this includes scope, which controls the machine-wide default for pnpm login. 이 명령은 ERR_PNPM_CONFIG_SET_NOT_A_PROJECT_SETTING 오류와 함께 실패하며, 해당 설정이 속하는 곳이 있으면 그 위치를 알려줍니다. pnpm config delete는 이미 해당 키를 가지고 있는 파일에서 여전히 그 키를 지울 수 있습니다.

get <key>#

Print the config value at the provided property path. Strings, numbers, and booleans are printed as plain text, objects and arrays as JSON, and an unset key as undefined. With --json, every value is printed as JSON.

key는 단순 키일 수 있습니다:

pnpm config get nodeVersion
pnpm config get --json nodeVersion
pnpm config get --json packageExtensions
pnpm config get --json allowBuilds
pnpm config get --json catalog

속성 경로일 수도 있습니다:

pnpm config get 'packageExtensions["@babel/parser"].peerDependencies["@babel/types"]'
pnpm config get --json 'packageExtensions["@babel/parser"].peerDependencies["@babel/types"]'
pnpm config get 'allowBuilds.react'
pnpm config get --json 'allowBuilds.react'
pnpm config get catalog.react
pnpm config get --json catalog.react

속성 경로의 구문은 JavaScript 속성 경로를 모방합니다.

delete <key>#

구성 파일에서 config key를 지웁니다.

list#

모든 구성 설정 표시하기 출력은 JSON 객체입니다.

pnpm config list masks tokens, usernames, passwords, TLS private keys, and credentials in proxy URLs. pnpm config get fails when asked for a protected auth setting.

옵션#

--global, -g#

전역 설정 파일에서 구성을 설정 하십시오.

With get and list, show the global configuration without the settings from the project's pnpm-workspace.yaml and .npmrc.

--location#

  • Type: project, global

기본적으로 --location은 global로 설정됩니다.

project로 설정하면 pnpm은 워크스페이스 루트의 pnpm-workspace.yaml에 설정을 씁니다(레지스트리/인증 설정의 경우 워크스페이스 루트의 .npmrc에 씁니다).

global로 설정하면 --global 옵션을 전달한 것과 동작이 동일합니다.

--json#

get 및 list가 모든 설정을 JSON 형식으로 표시하게 하고, set이 값을 JSON으로 파싱하게 합니다.