Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

npm

yarnpkg

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.

like image 343
Manivannan Avatar asked Oct 19 '16 14:10

Manivannan


People also ask

Can you use npm install with Yarn?

The Yarn maintainers recommend installing Yarn globally by using the NPM package manager, which is included by default with all Node. js installations. Use the -g flag with npm install to do this: sudo npm install -g yarn.

What is npm install -- save?

–save or -S: When the following command is used with npm install this will save all your installed core packages into the dependency section in the package. json file. Core dependencies are those packages without which your application will not give desired results.

Should I use Yarn install or npm install?

As previously stated, Yarn installs dependency packages in parallel, whereas NPM installs them sequentially. As a result, Yarn outperforms NPM when installing bigger files. Both tools can save dependent files to the offline cache.


1 Answers

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.

like image 78
galdin Avatar answered Oct 12 '22 10:10

galdin