75
votes

I am using Yarn to install the dependencies of my project. What is the equivalent of "npm install --save " in Yarn to update the entry in my package.json file? I can use "npm install --save " here, but I want to use Yarn as much as possible to improve performance and avoid confusion between npm and Yarn.

2

2 Answers

104
votes

The yarn equivalent tonpm install <name> --save is:

yarn add <name>

Here's the link to the docs for the full list of commands in comparison to npm.

30
votes

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

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

Yarn add documentation