Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pnpm in monorepo - how to run a command only in a specific package?

Let's say I want to install a package in a specific package in my monorepo, how do I do this from root?

in npm, you can do this with something like this:

npm install react --workspace=a

I searched the docs and I can't find a way to do this in pnpm.

like image 580
Jonathan Lightbringer Avatar asked Jan 27 '26 06:01

Jonathan Lightbringer


1 Answers

It is called "filtering" in pnpm docs (see it here).

In this case, you would run:

pnpm --filter=a add react

or

pnpm -F=a add react
like image 162
Zoltan Kochan Avatar answered Jan 29 '26 19:01

Zoltan Kochan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!