Forrest logo
back to the yarn tool

yarn:tldr:8a084

yarn: Install a module and save it as a dependency to the `package.json` file (add `--dev` to save as a dev dependency).
$ yarn add ${module_name}@${version}
try on your machine

This command is used with the Yarn package manager to add a specific version of a module to your project.

Here's how it works:

  1. yarn add is the command to add a new module to your project. This command will download and install the module, and add it as a dependency in your project's package.json file.

  2. ${module_name} represents the name of the module you want to add. This should be replaced with the actual module name you want to install. For example, if you want to install the lodash module, you would replace ${module_name} with lodash.

  3. @${version} is an optional part of the command that allows you to specify a specific version of the module you want to install. The @ symbol is followed by the desired version number. For example, if you want to install version 4.17.21 of the lodash module, you would replace ${version} with 4.17.21.

Putting it all together, an example usage of this command would be:

yarn add lodash@4.17.21

This command will install version 4.17.21 of the lodash module into your project.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the yarn tool