npmyarnpkg

What is the equivalent of "npm install <package_name> --save" in Yarn?


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


Solution

  • 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.