본문으로 건너뛰기
버전: Next

pnpm config

별칭: c

구성 파일들을 관리하기

The configuration files are in INI (the global) and YAML (the local) formats.

The local configuration file is located in the root of the project and is named pnpm-workspace.yaml.

전역 구성 파일은 다음 위치중 한 곳에 위치하게 됩니다.

  • $XDG_CONFIG_HOME env 변수가 설정된 경우, $XDG_CONFIG_HOME/pnpm/rc
  • 윈도우에서: ~/AppData/Local/pnpm/config/rc
  • MacOS에서: ~/Library/Preferences/pnpm/rc
  • Linux:에서 ~/.config/pnpm/rc

명령어

<key>와 <value> 설정하기

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

Without the --json flag, it parses the value as plain string:

pnpm config set --location=project nodeVersion 22.0.0

With the --json flag, it parses the value as JSON:

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

The --json flag also allows pnpm config set to create arrays and objects:

pnpm config set --location=project --json onlyBuiltDependencies '["react", "react-dom"]'
pnpm config set --location=project --json catalog '{ "react": "19" }'

The set command does not accept a property path.

<key> 가져오기

제공된 key의 config value를 출력하십시오.

The key can be a simple key:

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

It can also be a property path:

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

The syntax of the property path emulates JavaScript property paths.

<key> 삭제하기

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

list

모든 구성 설정 표시하기

옵션

--global, -g

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

--location

By default, --location is set to global.

When set to project, the .npmrc file at the nearest package.json will be used. If no .npmrc file is present in the directory, the setting will be written to a pnpm-workspace.yaml file.

Global로 설정할 때, --global 옵션으로 설정한 것과 성능이 동일 합니다.

--json

Make get and list show all the config settings in JSON format and make set parse the value as JSON.