How to install multiple yarn packages using `add`?

What does yarn add do?

When you are installing new package which is not already installed by any way and there is no entry into package.json file for that package, then you need to use yarn add package_name command. This command installs that package and simultaneously creates an entry into package.json file.

When to use yarn or yarn install?

Whenever you have all the entries into your package.json file for all the dependecies of your project, you should go for this command. This installs all the dependencies from package.json file as well as updates them if any.

Now coming back to your question, to add multiple packages at a time you just need to specify each package name using space like,

yarn add package1 package2 package 3 ...

If you're trying to install all packages in a package.json file, you can just run yarn to install all the packages.


Just add spaces between packages.
e.g.:

yarn add redux react-redux redux-starter-kit

If you want a replacement for npm install you can use the yarn or yarn install command.

Tags:

Yarnpkg