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
.
Общий конфигурационный файл расположен в одном из следующих мест:
- Если установлена переменная окружения(env) $XDG_CONFIG_HOME, то будет использоваться $XDG_CONFIG_HOME/pnpm/rc
- В Windows: ~/AppData/Local/pnpm/config/rc
- В macOS: ~/Library/Preferences/pnpm/rc
- В Linux: ~/.config/pnpm/rc
Команды
set <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.
get <key>
Вывести значение конфигурации для предоставленного ключа.
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.
delete <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.