pnpm peer dependencies auto-install

Viewed 9874

How (or on which file) to set true to do auto install dependencies ?

my terminal error:

my terminal error

hint: If you want peer dependencies to be automatically installed, set the "auto-install-peers" setting to "true". hint: If you don't want pnpm to fail on peer dependency issues, set the "strict-peer-dependencies" setting to "false".

auto-install-peers = true
4 Answers

pnpm uses npm's configuration formats. Hence, you should set configuration the same way you would for npm:

pnpm config set auto-install-peers true

Note: The above command uses the default config location which stores the setting for the local user account (at ~/.npmrc for linux, or at %USERPROFILE%\.npmrc for Windows). To store the setting inside your project in a .npmrc file that can be checked in to version control, you can use the method pointed out by @ZoltanKochan, or equivalently append --location project to the command:

pnpm config set auto-install-peers true --location project

You need to create a .npmrc at the root of your project with the following content:

auto-install-peers=true

The answer from mrmashal will work also but only for you locally. So, when someone else fetches your repository, they will not have the peers automatically installed.

Remove the node modules by running:

rm -rf node_modules

Then again run:

pnpm install

I had to create .npmrc at the root of the project with auto-install-peers=true, then delete the pnpm-lock.yaml file and run pnpm i --shamefully-hoist

Related