.npmrc
pnpm obtiene su configuración de la línea de comandos, las variables de entorno y los archivos .npmrc
.
El comando pnpm config
se puede usar para actualizar y editar el contenido de los archivos de usuario y .npmrc
globales.
Los cuatro archivos relevantes son:
- archivo de configuración por proyecto (
/ruta/a/mi/proyecto/.npmrc
) - archivo de configuración por espacio de trabajo (el directorio que contiene el archivo
pnpm-workspace.yaml
) - archivo de configuración por usuario (
~/.npmrc
) - archivo de configuración por usuario (
/etc/npmrc
)
Todos los archivos .npmrc
son una lista con formato INI de parámetros clave = valor
.
Los valores en los archivos .npmrc
pueden contener variables env usando la sintaxis ${NAME}
. Las variables env también se pueden especificar con valores predeterminados. El uso ${NAME-fallback}
devolverá fallback
si NAME
no está configurado. El uso ${NAME:-fallback}
devolverá fallback
si NAME
no está configurado o es un text vacio.
Configuración de elevación de dependencia
hoist
- Por defecto: true
- Tipo: boolean
Cuando es true
, todas las dependencias se elevan a node_modules/.pnpm/node_modules
. Esto hace que dependencias no listadas sean accesibles a todos los paquetes dentro de node_modules
.
hoist-pattern
- Por defecto: ['*']
- Tipo: string[]
Le dice a pnpm qué paquetes deben elevarse a node_modules/.pnpm/node_modules
. De predeterminada, todos los paquetes se elevan; sin embargo, si sabe que solo algunos paquetes tienen dependencias fantasmas, puede usar esta opción para elevar las dependencias fantasmas (recomendado).
Por ejemplo:
hoist-pattern[]=*eslint*
hoist-pattern[]=*babel*
También puede excluir patrones de la elevación utilizando !
.
Por ejemplo:
hoist-pattern[]=*types*
hoist-pattern[]=!@types/react
public-hoist-pattern
- Predeterminado: ['*eslint*', '*prettier*']
- Tipo: string[]
A diferencia de hoist-pattern
, que eleva las dependencias a un directorio de módulos ocultos dentro de la tienda virtual, public-hoist-pattern
eleva las dependencias que hacen coincidir el patrón con el directorio de módulos raíz. Elevar al directorio de módulos raíz significa que el código de la aplicación tendrá acceso a las dependencias fantasma, incluso si modifican la estrategia de resolución de manera incorrecta.
Esta configuración es útil cuando se trata de algunas herramientas conectables defectuosas que resuelven las dependencias correctamente.
Por ejemplo:
public-hoist-pattern[]=*plugin*
Nota: Establecer shamefully-hoist
a true
es lo mismo que configurar public-hoist-pattern
a *
.
También puede excluir patrones de la elevación utilizando !
.
Por ejemplo:
public-hoist-pattern[]=*types*
public-hoist-pattern[]=!@types/react
shamefully-hoist
- Por defecto: false
- Tipo: Boolean
De forma predeterminada, pnpm crea un semiestricto node_modules
, lo que significa que las dependencias tienen acceso a las dependencias no declaradas, pero los módulos fuera de node_modules
no. Con este diseño, la mayoría de los paquetes del ecosistema funcionan sin problemas. Sin embargo, si algunas herramientas solo funcionan cuando las dependencias elevadas están en la raíz de node_modules
, puede establecer esto en true
para elevarlas por usted.
Configuración de Node-Modules
store-dir
- Por defecto
- Si se establece la variable de entorno $PNPM_HOME, entonces $PNPM_HOME/store
- Si se establece la variable de entorno $XDG_DATA_HOME, entonces $XDG_DATA_HOME/pnpm/store
- En Windows: ~/AppData/Local/pnpm/store
- En macOS: ~/Library/pnpm/store
- En Linux: ~/.local/share/pnpm/store
- Tipo: path
La ubicación donde se guardan todos los paquetes en el disco.
El almacenamiento debe estar siempre en el mismo disco en el que se realiza la instalación, Así que habrá un almacenamiento por disco. Si hay un directorio de inicio en el disco actual, el almacenamiento se crea dentro de él. Si no hay un hogar en el disco,, entonces el almacenamiento se crea en la raíz del sistema de archivos. Por, si la instalación se realiza en un sistema de archivos montado en /mnt
, entonces el almacenamiento se creará en /mnt/.pnpm-store
. Lo mismo ocurre con los sistemas Windows.
Es posible configurar un almacenamiento desde un disco diferente, pero en ese caso, pnpm copiará los paquetes del almacenamiento en lugar de vincularlos, ya que los enlaces físicos son posibles en el mismo sistema de archivos.
modules-dir
- Por defecto: node_modules
- Tipo: path
El directorio en el que se instalarán las dependencias (en lugar de node_modules
).
node-linker
- Por defecto: aislado
- Tipo: aislado, elevado, pnp
Define qué enlazador debe usarse para instalar paquetes de Node.
- aisladas - las dependencias están vinculadas desde una tienda virtual en
node_modules/.pnpm
. - elevado - se crea un plano
node_modules
sin enlaces simbólicos. Igual que elnode_modules
creado por npm o Yarn Classic. Una de las bibliotecas de Yarn se usa para elevar, cuando se usa esta configuración. Razones legítimas para usar esta configuración:- Su herramienta no funciona bien con enlaces simbólicos. Lo más probable es que un proyecto React Native solo funcione si usa un
node_modules
elevado. - Su proyecto se implementa en un proveedor de alojamiento sin servidor. Algunos proveedores sin servidor (por ejemplo, AWS Lambda) no admiten enlaces simbólicos. Una solución alternativa para este problema es empaquetar la aplicación antes del despliegue.
- Si desea publicar su paquete con
"bundledDependencies"
. - Si está ejecutando Node.js con el indicador --preserve-symlinks.
- Su herramienta no funciona bien con enlaces simbólicos. Lo más probable es que un proyecto React Native solo funcione si usa un
- pnp - no
node_modules
. Plug'n'Play es una estrategia innovadora para Node que es utilizada por Yarn Berry. Se recomienda establecer también la configuraciónsymlink
enfalse
cuando se usapnp
como su enlazador.
symlink
- Por defecto: true
- Tipo: Boolean
Cuando symlink
se establece en false
, pnpm crea un directorio de tienda virtual sin ningún enlace simbólico. Es una configuración útil junto con node-linker=pnp
.
enable-modules-dir
- Por defecto: true
- Tipo: Boolean
Cuando false
, pnpm no escribirá ningún archivo en el directorio de módulos (node_modules
). This is useful for when the modules directory is mounted with filesystem in userspace (FUSE). There is an experimental CLI that allows you to mount a modules directory with FUSE: @pnpm/mount-modules.
virtual-store-dir
- Default: node_modules/.pnpm
- Types: path
The directory with links to the store. All direct and indirect dependencies of the project are linked into this directory.
This is a useful setting that can solve issues with long paths on Windows. If you have some dependencies with very long paths, you can select a virtual store in the root of your drive (for instance C:\my-project-store
).
Or you can set the virtual store to .pnpm
and add it to .gitignore
. This will make stacktraces cleaner as paths to dependencies will be one directory higher.
NOTE: the virtual store cannot be shared between several projects. Every project should have its own virtual store (except for in workspaces where the root is shared).
package-import-method
- Default: auto
- Type: auto, hardlink, copy, clone, clone-or-copy
Controls the way packages are imported from the store (if you want to disable symlinks inside node_modules
, then you need to change the node-linker setting, not this one).
- auto - try to clone packages from the store. If cloning is not supported then hardlink packages from the store. If neither cloning nor linking is possible, fall back to copying
- hardlink - hard link packages from the store
- clone-or-copy - try to clone packages from the store. If cloning is not supported then fall back to copying
- copy - copy packages from the store
- clone - clone (AKA copy-on-write or reference link) packages from the store
Cloning is the best way to write packages to node_modules. It is the fastest way and safest way. When cloning is used, you may edit files in your node_modules and they will not be modified in the central content-addressable store.
Unfortunately, not all file systems support cloning. We recommend using a copy-on-write (CoW) file system (for instance, Btrfs instead of Ext4 on Linux) for the best experience with pnpm.
Even though macOS supports cloning, there is currently a bug in Node.js that prevents us from using it in pnpm. If you have ideas how to fix it, help us.
modules-cache-max-age
- Default: 10080 (7 days in minutes)
- Type: number
The time in minutes after which orphan packages from the modules directory should be removed. pnpm keeps a cache of packages in the modules directory. This boosts installation speed when switching branches or downgrading dependencies.
Lockfile Settings
lockfile
- Por defecto: true
- Tipo: Boolean
When set to false
, pnpm won't read or generate a pnpm-lock.yaml
file.
prefer-frozen-lockfile
- Por defecto: true
- Tipo: Boolean
When set to true
and the available pnpm-lock.yaml
satisfies the package.json
dependencies directive, a headless installation is performed. A headless installation skips all dependency resolution as it does not need to modify the lockfile.
lockfile-include-tarball-url
- Por defecto: false
- Tipo: Boolean
Add the full URL to the package's tarball to every entry in pnpm-lock.yaml
.
Registry & Authentication Settings
registry
- Default: https://registry.npmjs.org/
- Type: url
The base URL of the npm package registry (trailing slash included).
<scope>:registry
The npm registry that should be used for packages of the specified scope. For example, setting @babel:registry=https://example.com/packages/npm/
will enforce that when you use pnpm add @babel/core
, or any @babel
scoped package, the package will be fetched from https://example.com/packages/npm
instead of the default registry.
<URL>:_authToken
Define the authentication bearer token to use when accessing the specified registry. For example:
//registry.npmjs.org/:_authToken=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
También puede utilizar una variable de entorno. Por ejemplo:
//registry.npmjs.org/:_authToken=${NPM_TOKEN}
O simplemente puede usar una variable de entorno directamente, sin cambiar .npmrc
en absoluto:
npm_config_//registry.npmjs.org/:_authToken=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
<URL>:tokenHelper
Un token de ayuda es un ejecutable que genera un token de autenticación. Esto se puede usar en situaciones en las que authToken no es un valor constante sino algo que se actualiza regularmente, donde un script u otra herramienta puede usar un token de actualización existente para obtener un nuevo token de acceso.
La configuración de la ruta al asistente debe ser una ruta absoluta, sin argumentos. Para mayor seguridad, solo se permite establecer este valor en el usuario .npmrc
. De lo contrario, un proyecto podría colocar un valor en el .npmrc
local de un proyecto y ejecutar ejecutables arbitrarios.
Configuración de un token de ayuda para el registro predeterminado:
tokenHelper=/home/ivan/token-generator
Configuración de un token de ayuda para el registro predeterminado:
//registry.corp.com:tokenHelper=/home/ivan/token-generator
Ajustes de Solicitud
ca
- Valor predeterminado: El certificado CA de npm
- Tipo: Cadena, Arreglo o nulo
El certificado de firma de la autoridad de certificación en el que se confía para las conexiones SSL con el registro. Los valores deben estar en formato PEM (también conocido como "X.509 codificado en Base-64 (.CER)"). Por ejemplo:
ca="-----BEGIN CERTIFICATE-----\nXXXX\nXXXX\n-----END CERTIFICATE-----"
Se establece en nulo para permitir sólo a los registradores conocidos, o a un certificado de CA específico para confiar en sólo la autorización de firma específica.
Se puede confiar en varias CA especificando una arreglo de certificados:
ca[]="..."
ca[]="..."
Consulte también la configuración strict-ssl
.
cafile
- Por defecto: null
- Tipo: path
Una ruta a un archivo que contiene uno o varios certificados de firma de autoridad de certificación. Similar a la configuración ca
, pero permite múltiples CA, así como que la información de CA se almacene en un archivo en lugar de especificarse a través de CLI.
cert
- Por defecto: null
- Tipo: String
Un certificado de cliente para pasar al acceder al registro. Los valores deben estar en formato PEM (también conocido como "X.509 codificado en Base-64 (.CER)"). Por ejemplo:
cert="-----BEGIN CERTIFICATE-----\nXXXX\nXXXX\n-----END CERTIFICATE-----"
No es la ruta a un archivo de certificado (y no existe la opción certfile
).
key
- Por defecto: null
- Tipo: String
Una clave de cliente para pasar al acceder al registro. Los valores deben estar en formato PEM (también conocido como "X.509 codificado en Base-64 (.CER)"). Por ejemplo:
key="-----BEGIN PRIVATE KEY-----\nXXXX\nXXXX\n-----END PRIVATE KEY-----"
It is not the path to a key file (and there is no keyfile
option).
Esta configuración contiene información confidencial. No lo escriba en un archivo local .npmrc
asignado al repositorio.
git-shallow-hosts
- Valor predeterminado: ['github.com', 'gist.github.com', 'gitlab.com', 'bitbucket.com', 'bitbucket.org']
- Tipo: string[]
Al obtener dependencias que son repositorios de Git, si el host aparece en esta configuración, pnpm usará una clonación superficial para obtener solo la confirmación necesaria, no todo el historial.
https-proxy
- Por defecto: null
- Tipo: url
Un proxy para usar con solicitudes HTTPS salientes. Si se establecen las variables de entorno HTTPS_PROXY
, https_proxy
, HTTP_PROXY
o http_proxy
, utilizarán sus valores en su lugar.
Si su URL de proxy contiene un nombre de usuario y una contraseña, asegúrese de codificarlos como URL. Por ejemplo:
https-proxy=https://use%21r:pas%2As@my.proxy:1234/foo
No codifique los dos puntos (:
) entre el nombre de usuario y la contraseña.
http-proxy
proxy
- Por defecto: null
- Tipo: url
Un proxy para usar con solicitudes http salientes. If the HTTP_PROXY or http_proxy environment variables are set, proxy settings will be honored by the underlying request library.
local-address
- Default: undefined
- Type: IP Address
The IP address of the local interface to use when making connections to the npm registry.
maxsockets
- Default: network-concurrency x 3
- Type: Number
The maximum number of connections to use per origin (protocol/host/port combination).
noproxy
- Por defecto: null
- Tipo: String
A comma-separated string of domain extensions that a proxy should not be used for.
strict-ssl
- Por defecto: true
- Tipo: Boolean
Whether or not to do SSL key validation when making requests to the registry via HTTPS.
See also the ca
option.
network-concurrency
- Default: 16
- Type: Number
Controls the maximum number of HTTP(S) requests to process simultaneously.
fetch-retries
- Default: 2
- Type: Number
How many times to retry if pnpm fails to fetch from the registry.
fetch-retry-factor
- Default: 10
- Type: Number
The exponential factor for retry backoff.
fetch-retry-mintimeout
- Default: 10000 (10 seconds)
- Type: Number
The minimum (base) timeout for retrying requests.
fetch-retry-maxtimeout
- Default: 60000 (1 minute)
- Type: Number
The maximum fallback timeout to ensure the retry factor does not make requests too long.
fetch-timeout
- Default: 60000 (1 minute)
- Type: Number
The maximum amount of time to wait for HTTP requests to complete.
Peer Dependency Settings
auto-install-peers
- Por defecto: true
- Tipo: Boolean
When true
, any missing non-optional peer dependencies are automatically installed.
dedupe-peer-dependents
- Por defecto: true
- Tipo: Boolean
When this setting is set to true
, packages with peer dependencies will be deduplicated after peers resolution.
For instance, let's say we have a workspace with two projects and both of them have webpack
in their dependencies. webpack
has esbuild
in its optional peer dependencies, and one of the projects has esbuild
in its dependencies. In this case, pnpm will link two instances of webpack
to the node_modules/.pnpm
directory: one with esbuild
and another one without it:
node_modules
.pnpm
webpack@1.0.0_esbuild@1.0.0
webpack@1.0.0
project1
node_modules
webpack -> ../../node_modules/.pnpm/webpack@1.0.0/node_modules/webpack
project2
node_modules
webpack -> ../../node_modules/.pnpm/webpack@1.0.0_esbuild@1.0.0/node_modules/webpack
esbuild
This makes sense because webpack
is used in two projects, and one of the projects doesn't have esbuild
, so the two projects cannot share the same instance of webpack
. However, this is not what most developers expect, especially since in a hoisted node_modules
, there would only be one instance of webpack
. Therefore, you may now use the dedupe-peer-dependents
setting to deduplicate webpack
when it has no conflicting peer dependencies (explanation at the end). In this case, if we set dedupe-peer-dependents
to true
, both projects will use the same webpack
instance, which is the one that has esbuild
resolved:
node_modules
.pnpm
webpack@1.0.0_esbuild@1.0.0
project1
node_modules
webpack -> ../../node_modules/.pnpm/webpack@1.0.0_esbuild@1.0.0/node_modules/webpack
project2
node_modules
webpack -> ../../node_modules/.pnpm/webpack@1.0.0_esbuild@1.0.0/node_modules/webpack
esbuild
What are conflicting peer dependencies? By conflicting peer dependencies we mean a scenario like the following one:
node_modules
.pnpm
webpack@1.0.0_react@16.0.0_esbuild@1.0.0
webpack@1.0.0_react@17.0.0
project1
node_modules
webpack -> ../../node_modules/.pnpm/webpack@1.0.0/node_modules/webpack
react (v17)
project2
node_modules
webpack -> ../../node_modules/.pnpm/webpack@1.0.0_esbuild@1.0.0/node_modules/webpack
esbuild
react (v16)
In this case, we cannot dedupe webpack
as webpack
has react
in its peer dependencies and react
is resolved from two different versions in the context of the two projects.
strict-peer-dependencies
- Por defecto: false
- Tipo: Boolean
If this is enabled, commands will fail if there is a missing or invalid peer dependency in the tree.
resolve-peers-from-workspace-root
- Por defecto: true
- Tipo: Boolean
When enabled, dependencies of the root workspace project are used to resolve peer dependencies of any projects in the workspace. It is a useful feature as you can install your peer dependencies only in the root of the workspace, and you can be sure that all projects in the workspace use the same versions of the peer dependencies.
CLI Settings
[no-]color
- Default: auto
- Type: auto, always, never
Controls colors in the output.
- auto - output uses colors when the standard output is a terminal or TTY.
- always - ignore the difference between terminals and pipes. You’ll rarely want this; in most scenarios, if you want color codes in your redirected output, you can instead pass a
--color
flag to the pnpm command to force it to use color codes. The default setting is almost always what you’ll want. - never - turns off colors. This is the setting used by
--no-color
.
loglevel
- Default: info
- Type: debug, info, warn, error
Any logs at or higher than the given level will be shown. You can instead pass --silent
to turn off all output logs.
use-beta-cli
- Por defecto: false
- Tipo: Boolean
Experimental option that enables beta features of the CLI. This means that you may get some changes to the CLI functionality that are breaking changes, or potentially bugs.
recursive-install
- Por defecto: true
- Tipo: Boolean
If this is enabled, the primary behaviour of pnpm install
becomes that of pnpm install -r
, meaning the install is performed on all workspace or subdirectory packages.
Else, pnpm install
will exclusively build the package in the current directory.
engine-strict
- Por defecto: false
- Tipo: Boolean
If this is enabled, pnpm will not install any package that claims to not be compatible with the current Node version.
Regardless of this configuration, installation will always fail if a project (not a dependency) specifies an incompatible version in its engines
field.
npm-path
- Tipo: path
The location of the npm binary that pnpm uses for some actions, like publishing.
Build Settings
ignore-scripts
- Por defecto: false
- Tipo: Boolean
No ejecuta ningún sript definido en el proyecto package.json
y sus dependencias.
Esta bandera no impide la ejecución de .pnpmfile.cjs
ignore-dep-scripts
- Por defecto: false
- Tipo: Boolean
Do not execute any scripts of the installed packages. Scripts of the projects are executed.
child-concurrency
- Default: 5
- Type: Number
The maximum number of child processes to allocate simultaneously to build node_modules.
side-effects-cache
- Por defecto: true
- Tipo: Boolean
Use and cache the results of (pre/post)install hooks.
side-effects-cache-readonly
- Por defecto: false
- Tipo: Boolean
Only use the side effects cache if present, do not create it for new packages.
unsafe-perm
- Default: false IF running as root, ELSE true
- Tipo: Boolean
Set to true to enable UID/GID switching when running package scripts. If set explicitly to false, then installing as a non-root user will fail.
Node.js Settings
use-node-version
- Default: undefined
- Type: semver
Specifies which exact Node.js version should be used for the project's runtime. pnpm will automatically install the specified version of Node.js and use it for running pnpm run
commands or the pnpm node
command.
This may be used instead of .nvmrc
and nvm
. Instead of the following .nvmrc
file:
16.16.0
Use this .npmrc
file:
use-node-version=16.16.0
node-version
- Default: the value returned by node -v, without the v prefix
- Type: semver
The Node.js version to use when checking a package's engines
setting.
If you want to prevent contributors of your project from adding new incompatible dependencies, use node-version
and engine-strict
in a .npmrc
file at the root of the project:
node-version=12.22.0
engine-strict=true
This way, even if someone is using Node.js v16, they will not be able to install a new dependency that doesn't support Node.js v12.22.0.
node-mirror:<releaseDir>
- Default:
https://nodejs.org/download/<releaseDir>/
- Type: URL
Sets the base URL for downloading Node.js. The <releaseDir>
portion of this setting can be any directory from https://nodejs.org/download: release
, rc
, nightly
, v8-canary
, etc.
Here is how pnpm may be configured to download Node.js from Node.js mirror in China:
node-mirror:release=https://npmmirror.com/mirrors/node/
node-mirror:rc=https://npmmirror.com/mirrors/node-rc/
node-mirror:nightly=https://npmmirror.com/mirrors/node-nightly/
Workspace Settings
link-workspace-packages
- Por defecto: true
- Type: true, false, deep
If this is enabled, locally available packages are linked to node_modules
instead of being downloaded from the registry. This is very convenient in a monorepo. If you need local packages to also be linked to subdependencies, you can use the deep
setting.
Else, packages are downloaded and installed from the registry. However, workspace packages can still be linked by using the workspace:
range protocol.
prefer-workspace-packages
- Por defecto: false
- Tipo: Boolean
If this is enabled, local packages from the workspace are preferred over packages from the registry, even if there is a newer version of the package in the registry.
This setting is only useful if the workspace doesn't use save-workspace-protocol
.
shared-workspace-lockfile
- Por defecto: true
- Tipo: Boolean
If this is enabled, pnpm creates a single pnpm-lock.yaml
file in the root of the workspace. This also means that all dependencies of workspace packages will be in a single node_modules
(and get symlinked to their package node_modules
folder for Node's module resolution).
Advantages of this option:
- every dependency is a singleton
- faster installations in a monorepo
- fewer changes in code reviews as they are all in one file
Even though all the dependencies will be hard linked into the root node_modules
, packages will have access only to those dependencies that are declared in their package.json
, so pnpm's strictness is preserved. This is a result of the aforementioned symbolic linking.
save-workspace-protocol
- Default: rolling
- Type: true, false, rolling
This setting controls how dependencies that are linked from the workspace are added to package.json
.
If foo@1.0.0
is in the workspace and you run pnpm add foo
in another project of the workspace, below is how foo
will be added to the dependencies field. The save-prefix
setting also influences how the spec is created.
save-workspace-protocol | save-prefix | spec |
---|---|---|
false | '' | 1.0.0 |
false | '~' | ~1.0.0 |
false | '^' | ^1.0.0 |
true | '' | workspace:1.0.0 |
true | '~' | workspace:~1.0.0 |
true | '^' | workspace:^1.0.0 |
rolling | '' | workspace:* |
rolling | '~' | workspace:~ |
rolling | '^' | workspace:^ |
include-workspace-root
- Por defecto: false
- Tipo: Boolean
When executing commands recursively in a workspace, execute them on the root workspace project as well.
ignore-workspace-cycles
Added in: v8.1.0
- Por defecto: false
- Tipo: Boolean
When set to true
, no workspace cycle warnings will be printed.
Other Settings
use-running-store-server
- Por defecto: false
- Tipo: Boolean
Only allows installation with a store server. If no store server is running, installation will fail.
save-prefix
- Default: '^'
- Tipo: String
Configure how versions of packages installed to a package.json
file get prefixed.
For example, if a package has version 1.2.3
, by default its version is set to ^1.2.3
which allows minor upgrades for that package, but after pnpm config set save-prefix='~'
it would be set to ~1.2.3
which only allows patch upgrades.
This setting is ignored when the added package has a range specified. For instance, pnpm add foo@2
will set the version of foo
in package.json
to 2
, regardless of the value of save-prefix
.
tag
- Default: latest
- Tipo: String
If you pnpm add
a package and you don't provide a specific version, then it will install the package at the version registered under the tag from this setting.
This also sets the tag that is added to the package@version
specified by the pnpm tag
command if no explicit tag is given.
global-dir
- Por defecto
- If the $XDG_DATA_HOME env variable is set, then $XDG_DATA_HOME/pnpm/global
- On Windows: ~/AppData/Local/pnpm/global
- On macOS: ~/Library/pnpm/global
- On Linux: ~/.local/share/pnpm/global
- Tipo: path
Specify a custom directory to store global packages.
global-bin-dir
- Por defecto
- If the $XDG_DATA_HOME env variable is set, then $XDG_DATA_HOME/pnpm
- On Windows: ~/AppData/Local/pnpm
- On macOS: ~/Library/pnpm
- On Linux: ~/.local/share/pnpm
- Tipo: path
Allows to set the target directory for the bin files of globally installed packages.
state-dir
- Por defecto
- If the $XDG_STATE_HOME env variable is set, then $XDG_STATE_HOME/pnpm
- On Windows: ~/AppData/Local/pnpm-state
- On macOS: ~/.pnpm-state
- On Linux: ~/.local/state/pnpm
- Tipo: path
The directory where pnpm creates the pnpm-state.json
file that is currently used only by the update checker.
cache-dir
- Por defecto
- If the $XDG_CACHE_HOME env variable is set, then $XDG_CACHE_HOME/pnpm
- On Windows: ~/AppData/Local/pnpm-cache
- On macOS: ~/Library/Caches/pnpm
- On Linux: ~/.cache/pnpm
- Tipo: path
The location of the package metadata cache.
use-stderr
- Por defecto: false
- Tipo: Boolean
When true, all the output is written to stderr.
update-notifier
- Por defecto: true
- Tipo: Boolean
Set to false
to suppress the update notification when using an older version of pnpm than the latest.
prefer-symlinked-executables
- Default: true, when node-linker is set to hoisted and the system is POSIX
- Tipo: Boolean
Create symlinks to executables in node_modules/.bin
instead of command shims. This setting is ignored on Windows, where only command shims work.
verify-store-integrity
- Por defecto: true
- Tipo: Boolean
By default, if a file in the store has been modified, the content of this file is checked before linking it to a project's node_modules
. If verify-store-integrity
is set to false
, files in the content-addressable store will not be checked during installation.
ignore-compatibility-db
- Por defecto: false
- Tipo: Boolean
During installation the dependencies of some packages are automatically patched. If you want to disable this, set this config to false
.
The patches are applied from Yarn's @yarnpkg/extensions
package.
resolution-mode
- Default: lowest-direct
- Type: highest, time-based, lowest-direct
When resolution-mode
is set to time-based
, dependencies will be resolved the following way:
- Direct dependencies will be resolved to their lowest versions. So if there is
foo@^1.1.0
in the dependencies, then1.1.0
will be installed. - Subdependencies will be resolved from versions that were published before the last direct dependency was published.
With this resolution mode installations with warm cache are faster. It also reduces the chance of subdependency hijacking as subdependencies will be updated only if direct dependencies are updated.
This resolution mode works only with npm's full metadata. So it is slower in some scenarios. However, if you use Verdaccio v5.15.1 or newer, you may set the registry-supports-time-field
setting to true
, and it will be really fast.
When resolution-mode
is set to lowest-direct
, direct dependencies will be resolved to their lowest versions.
registry-supports-time-field
- Por defecto: false
- Tipo: Boolean
Set this to true
if the registry that you are using returns the "time" field in the abbreviated metadata. As of now, only Verdaccio from v5.15.1 supports this.
extend-node-path
- Por defecto: true
- Tipo: Boolean
When false
, the NODE_PATH
environment variable is not set in the command shims.
deploy-all-files
- Por defecto: false
- Tipo: Boolean
When deploying a package or installing a local package, all files of the package are copied. By default, if the package has a "files"
field in the package.json
, then only the listed files and directories are copied.
dedupe-direct-deps
Added in: v8.1.0
- Por defecto: false
- Tipo: Boolean
When set to true
, dependencies that are already symlinked to the root node_modules
directory of the workspace will not be symlinked to subproject node_modules
directories.