Reputation: 7642
I have the classic Lerna set up. root directory, packages folder, 2 subdirectories
I want to just run yarn install
inside one package and just to install the dependencies for this package. for some reason when I run it (even from inside this folder) it's then installing node_modules
inside the root, packageA and packageB.
is there a solution to just allow me to install node_modules
for a chosen directory?
Upvotes: 16
Views: 27981
Reputation: 40444
Do the following from the root directory:
yarn workspace <workspace-name> add <package-name>
Upvotes: 8
Reputation: 386
Check out 'focused workspaces' https://classic.yarnpkg.com/blog/2018/05/18/focused-workspaces/
From inside the package you want to work on, run
yarn install --focus
and Yarn will install the local dependencies as well as any dependencies in monorepo-sibling dependencies, but not all dependencies across all packages in the monorepo.
Upvotes: 14