pnpm gets its config settings 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.

The four relevant files are:

All .npmrc files are an ini-formatted list of key = value parameters.

Dependency Hoisting Settings

hoist

Added in: v4.0.0

When true, all dependencies are hoisted to node_modules/.pnpm. This makes unlisted dependencies accessible to all packages inside node_modules.

hoist-pattern

Added in: v4.0.0

Tells pnpm, which packages should be hoisted to node_modules/.pnpm. By default, all packages are hoisted. However, if you know that only some buggy packages are requiring unlisted dependencies, you may hoist just them.

For instance:

hoist-pattern[]=*eslint*
hoist-pattern[]=*babel*

public-hoist-pattern

Added in: v5.2.0

Unlike hoist-pattern, which hoists dependencies to a hidden modules directory inside the virtual store, public-hoist-pattern hoists dependencies matching the pattern to the root modules directory. Hoisting to the root modules directory means that application code will have access to phantom dependencies (dependencies that are not direct dependencies of the project).

This setting is useful when dealing with some buggy pluggable tools that don't resolve dependencies properly.

For instance:

public-hoist-pattern[]=*plugin*

Note: Setting shamefully-hoist to true is the same as setting public-hoist-pattern to *.

shamefully-hoist

Added in: v1.34.0 (Renamed from shamefully-flatten in v4.0.0)

By default, pnpm creates a semistrict node_modules. It means that your dependencies have access to undeclared dependencies but your code does not. With this layout, most of the packages in the ecosystem work with no issues. However, if some tooling only works when the hoisted dependencies are in the root of node_modules, you can set this config to true.

Node-Modules Settings

store-dir

Added in: v4.2.0 (renamed from store)

The location where all the packages are saved on the disk.

The store should be always on the same disk on which installation is happening. So there will be one store per disk. If there is a home directory on the current disk, then the store is created in <home dir>/.pnpm-store. If there is no homedir on the disk, then the store is created in the root. For example, if installation is happening on disk D then the store will be created in D:\.pnpm-store.

It is possible to set a store from a different disk but in that case pnpm will copy, not link, packages from the store. Hard links are possible only inside a filesystem.

modules-dir

Added in: v4.14.0

The directory in which dependencies will be installed (instead of node_modules).

node-linker

Added in: v5.9.0

Defines what linker should be used for installing Node packages. By default, pnpm creates a symlinked modules directory. But the Plug'n'Play installation strategy is supported as well. Plug'n'Play is an innovative installation strategy for Node that is used by Yarn v2 by default.

It is recommended to also set the symlink setting to false, when using node-linker=pnp.

symlink

Added in: v5.9.0

When symlink is set to false, pnpm creates a virtual store directory without any symlinks. It is a useful setting together with node-linker=pnp.

enable-modules-dir

Added in: v5.15.0

When false, pnpm will not write any files to the modules directory (node_modules). This is useful for when the modules directory is mounted with filesystem in userspace (FUSE). There is an experimental CLI that allows to mount a modules directory with FUSE: @pnpm/mount-modules.

verify-store-integrity

Added in: v1.8.0

If false, doesn't check whether packages in the store were mutated.

virtual-store-dir

Added in: v4.1.0

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 the stacktraces nicer as paths to dependencies will have one directory less.

NOTE: the virtual store cannot be shared between several projects. Every project should have its own virtual store.

package-import-method

Added in: v1.25.0

Controls the way packages are imported from the store.

Lockfile Settings

lockfile

Added in: v1.32.0 (initially named shrinkwrap)

When set to false, pnpm won't read or generate a pnpm-lock.yaml file.

prefer-frozen-lockfile

Added in: v1.37.1 (initially named prefer-frozen-shrinkwrap)

When true and the available pnpm-lock.yaml satisfies the package.json then a headless installation is performed. A headless installation is faster than a regular one because it skips dependencies resolution and peers resolution.

Registry & Authentication Settings

registry

The base URL of the npm package registry.

<scope>:registry

The npm registry that should be used for packages of the specified scope. For instance:

@babel:registry=https://gitlab.com/api/v4/packages/npm/

When pnpm add @babel/core will be used, @babel/core will be fetched from https://registry.example.com/ instead of the default registry.

<URL>:_authToken

Defines the authentication bearer token to use when accessing the specified registry. For example:

//registry.npmjs.org/:_authToken=ffffffff-ffff-ffff-ffff-ffffffffffff 

If the token is saved in an environment variable, it can be used as the value:

//registry.npmjs.org/:_authToken=${NPM_TOKEN}

<URL>:always-auth

Force pnpm to always require authentication (even for GET requests), when accessing the specified registry. For example:

@babel:registry=https://gitlab.com/api/v4/packages/npm/
//gitlab.com/api/v4/packages/npm/:always-auth=true

registry=https://registry.npmjs.org/
//registry.npmjs.org/:always-auth=true

Request Settings

ca

The Certificate Authority signing certificate that is trusted for SSL connections to the registry. Values should be in PEM format (Windows calls it "Base-64 encoded X.509 (.CER)") with newlines replaced by the string "\n". For example:

ca="-----BEGIN CERTIFICATE-----\nXXXX\nXXXX\n-----END CERTIFICATE-----"

Set to null to only allow "known" registrars, or to a specific CA cert to trust only that specific signing authority.

Multiple CAs can be trusted by specifying an array of certificates:

ca[]="..."
ca[]="..."

See also the strict-ssl config.

cafile

A path to a file containing one or multiple Certificate Authority signing certificates. Similar to the ca setting, but allows for multiple CA’s, as well as for the CA information to be stored in a file on disk.

cert

A client certificate to pass when accessing the registry. Values should be in PEM format (Windows calls it "Base-64 encoded X.509 (.CER)") with newlines replaced by the string "\n". For example:

cert="-----BEGIN CERTIFICATE-----\nXXXX\nXXXX\n-----END CERTIFICATE-----"

It is not the path to a certificate file (and there is no "certfile" option).

https-proxy

A proxy to use for outgoing https requests. If the HTTPS_PROXY or https_proxy or HTTP_PROXY or http_proxy environment variables are set, proxy settings will be honored by the underlying request library.

key

A client key to pass when accessing the registry. Values should be in PEM format with newlines replaced by the string "\n". For example:

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).

local-address

The IP address of the local interface to use when making connections to the npm registry. Must be IPv4 in versions of Node prior to 0.12.

proxy

A proxy to use for outgoing http requests. If the HTTP_PROXY or http_proxy environment variables are set, proxy settings will be honored by the underlying request library.

strict-ssl

Whether or not to do SSL key validation when making requests to the registry via https.

See also the ca config.

network-concurrency

Controls the maximum number of HTTP requests that can be done simultaneously.

fetch-retries

The "retries" config for the retry module to use when fetching packages from the registry.

fetch-retry-factor

The "factor" config for the retry module to use when fetching packages.

fetch-retry-mintimeout

The "minTimeout" config for the retry module to use when fetching packages.

fetch-retry-maxtimeout

The "maxTimeout" config for the retry module to use when fetching packages.

CLI Settings

color

Added in: v4.1.0

Controls colors in the output.

loglevel

Added in: v4.13.0

What level of logs to report. Any logs at or higher than the given level will be shown. Or use --silent to turn off all logging.

strict-peer-dependencies

Added in: v2.15.0

If true, commands fail on missing or invalid peer dependencies.

use-beta-cli

Added in: v3.6.0

When true, beta features of the CLI are used. This means that you may get some changes to the CLI functionality that are breaking changes.

recursive-install

Added in: v5.4.0

When false, pnpm install will only install dependencies for the current project. pnpm install -r will have to be used in order to install all dependencies of all projects in a monorepo.

engine-strict

If set to true, then pnpm will stubbornly refuse to install (or even consider installing) any package that claims to not be compatible with the current Node.js version.

Regardless of this config, installation will always fail when a project (not a dependency) will specify an incompatible pnpm version in its engines field.

npm-path

Added in: v4.8.0

The location of the npm binary that pnpm uses for some actions (like publishing).

Build Settings

child-concurrency

Controls the number of child processes run parallelly to build node_modules.

side-effects-cache

Added in: v1.31.0

Stability: Experimental

Use and cache the results of (pre/post)install hooks.

side-effects-cache-readonly

Added in: v1.31.0

Stability: Experimental

Only use the side effects cache if present, do not create it for new packages.

unsafe-perm

Set to true to suppress the UID/GID switching when running package scripts. If set explicitly to false, then installing as a non-root user will fail.

Other Settings

use-running-store-server

Added in: v2.5.0

Only allows installation with a store server. If no store server is running, installation will fail.

save-prefix

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 config is ignored when the added package has a range specified. For instance, pnpm add foo@2 will add 2 to package.json, regardless of the value of save-prefix.

tag

If you ask pnpm to install a package and don’t tell it a specific version, then it will install the specified tag.

Also the tag that is added to the package@version specified by the pnpm tag command, if no explicit tag is given.

global-dir

Added in: v4.2.0

Specify a custom directory to store global packages.