설정

pnpm 설정은 두 가지 범주로 나뉩니다:

  • 인증 및 인증서 설정은 INI 파일에 저장됩니다. 여기에는 민감한 자격 증명이 포함되어 있으므로 저장소에 커밋해서는 안 됩니다. 자세한 내용은 인증 설정을 참조하세요.
  • All other settings are stored in YAML files: the project pnpm-workspace.yaml and the global config.yaml. Some settings are project-only and are ignored in the global config.yaml (see Global configuration).

pnpm does not read settings from the pnpm field of package.json. A setting found there is ignored with a warning. Define it in pnpm-workspace.yaml.

로컬 프로젝트 설정#

프로젝트 수준 설정은 pnpm-workspace.yaml에 작성합니다:

pnpm-workspace.yaml
nodeVersion: "22.22.3"
saveExact: true

전역 설정#

전역 YAML 설정 파일(config.yaml)은 다음 경로 중 하나에 있습니다:

  • $XDG_CONFIG_HOME 환경 변수가 설정된 경우, $XDG_CONFIG_HOME/pnpm/config.yaml
  • On Windows: %LOCALAPPDATA%\pnpm\config\config.yaml
  • macOS의 경우: ~/Library/Preferences/pnpm/config.yaml
  • Linux의 경우: ~/.config/pnpm/config.yaml

Not every setting may be set in the global config.yaml. Settings that apply to the whole machine, such as storeDir, cacheDir, packageImportMethod, minimumReleaseAge, and network settings, may be set there. Settings that define the structure of a project's node_modules or workspace, such as nodeLinker, hoistPattern, publicHoistPattern, shamefullyHoist, or linkWorkspacePackages, are project-only: they have to be set in pnpm-workspace.yaml, so that the project installs the same way on every machine. Registry routes may be set globally, but the server descriptions serverType and supportsTimeField are read only from pnpm-workspace.yaml (see Registries).

pnpm config set --global refuses project-only settings with ERR_PNPM_CONFIG_SET_UNSUPPORTED_YAML_CONFIG_KEY. If they are written to config.yaml by hand, pnpm prints a warning that names them and ignores them.

To share project-only settings across several projects, publish them as a config dependency and add it to each project.

Global registry credentials go in auth.ini in the same directory. See Auth file locations.

환경 변수#

이름이 pnpm_config_(또는 PNPM_CONFIG_)로 시작하는 환경 변수는 설정으로 로드됩니다. 이러한 환경 변수는 pnpm-workspace.yaml의 설정을 재정의하지만 CLI 인수는 재정의하지 않습니다.

경고

pnpm does not read npm_config_* environment variables. 대신 pnpm_config_* 환경 변수를 사용하세요(예: npm_config_registry 대신 pnpm_config_registry). The exceptions are:

  • NPM_CONFIG_WORKSPACE_DIR, which sets the workspace directory.
  • npm_config_userconfig, which points to a user .npmrc for auth settings.
  • URL-scoped credentials such as npm_config_//registry.example.com/:_authToken.

예시:

pnpm_config_save_exact=true pnpm add foo

If you need pnpm to work across multiple hard drives or filesystems, read the FAQ.

설정 관리에 대한 자세한 내용은 config command를 참조하세요.