Home > OS >  Install package only for one project
Install package only for one project

Time:06-07

Let's say I have this file hierarchy:

packages/project1
packages/project2

and the workspace is packages/*

How do I install an npm package only for project1 and not for project2 (without using just "npm install" inside the packages/project1 directory because I need the yarn lock file to include the dependency)?

Does yarn support this functionality? Couldn't find it in the docs.

CodePudding user response:

yarn add <package...> [--dev/-D]

Using --dev or -D will install one or more packages in your devDependencies. See here

  • Related