Settings (.npmrc)
pnpm gets its configuration from the command line, environment variables, and
.npmrc
files.
The pnpm config
command can be used to update and edit the contents of the
user and global .npmrc
files.
四個相關的檔案是:
- per-project configuration file (
/path/to/my/project/.npmrc
) - per-workspace configuration file (the directory that contains the
pnpm-workspace.yaml
file) - per-user configuration file (
~/.npmrc
) - global configuration file (
/etc/npmrc
)
All .npmrc
files are an INI-formatted list of key = value
parameters.
Values in the .npmrc
files may contain env variables using the ${NAME}
syntax. 您也可以使用預設值來指定環境變數。 Using ${NAME-fallback}
will return fallback
if NAME
isn't set. ${NAME:-fallback}
will return fallback
if NAME
isn't set, or is an empty string.