yarn install is used to install all dependencies for a project. This is most
commonly used when you have just checked out code for a project, or when
another developer on the project has added a new dependency that you need to
If you are used to using npm you might be expecting to use
--save-dev. These have been replaced by
yarn add and
yarn add --dev. For
more information, see
yarn add documentation.
yarn with no command will run
yarn install, passing through any provided flags.
If you need reproducible dependencies, which is usually the case with the continuous integration systems, you should pass
Install all the dependencies listed within
package.json in the local
yarn.lock file is utilized as follows:
yarn.lockis present and is enough to satisfy all the dependencies listed in
package.json, the exact versions recorded in
yarn.lockare installed, and
yarn.lockwill be unchanged. Yarn will not check for newer versions.
yarn.lockis absent, or is not enough to satisfy all the dependencies listed in
package.json(for example, if you manually add a dependency to
package.json), Yarn looks for the newest versions available that satisfy the constraints in
package.json. The results are written to
If you want to ensure
yarn.lock is not updated, use
Verifies that already installed files in
node_modules did not get removed.
Install all the dependencies, but only allow one version for each package. On the first run this will prompt you to
choose a single version for each package that is depended on at multiple
version ranges. These will be added to your
package.json under a
This refetches all packages, even ones that were previously installed.
Outputs an HTTP archive from all the network requests performed during the installation. HAR files are commonly used to investigate network performance, and can be analyzed with tools such as Google’s HAR Analyzer or HAR Viewer.
Do not execute any scripts defined in the project package.json and its dependencies.
Specifies an alternate location for the
node_modules directory, instead of the default
Don’t read or generate a
Yarn will not install any package listed in
devDependencies if the
NODE_ENV environment variable is set to
production. Use this flag to instruct Yarn to ignore
NODE_ENV and take its production-or-not status from this flag instead.
--productionis the same as
--prodis an alias of
Don’t generate a
Shallowly installs a package’s sibling workspace dependencies underneath its
node_modules folder. This allows you to run that workspace without building the other workspaces it depends on.
Must be run inside an individual workspace in a workspaces project. Can not be run in a non-workspaces project or at the root of a workspaces project.
Don’t generate a
yarn.lock lockfile and fail if an update is needed.
Run yarn install without printing installation log.
Ignore engines check.
Don’t install optional dependencies.
Run yarn install in offline mode.
Disable interactive prompts, like when there’s an invalid version of a dependency.
Update checksums in the
yarn.lock lockfile if there’s a mismatch between them and their package’s checksum.
Checks for known security issues with the installed packages. A count of found issues will be added to the output. Use the
yarn audit command for additional details. Unlike npm, which automatically runs an audit on every install, yarn will only do so when requested. (This may change in a later update as the feature is proven to be stable.)
Prevent yarn from creating symlinks for any binaries the package might contain.
Create hardlinks to the repeated modules in node_modules.
Show additional logs while installing dependencies