Reputation: 1289
I'm a .net developer with exposure to nuget package manager console only. I was reading about nodejs and reactjs; where both require npm & yarn packet managers.
Can any one explain the difference between these products? And why are they introduced?
Upvotes: 23
Views: 13831
Reputation: 740
npm is the Node Package Manager. Basically it is used to install dependencies. In your case you will need this for React.
Yarn package manager is also used for to install dependencies i.e to install Javascript packages.
The difference between npm and yarn is:
Takes 10-12sec to install packages.
Yarn installs all dependencies parallel.
Does not always require an internet connection to install dependencies.
Takes 20-25sec to install packages.
NPM always installs each dependency one after the other which may end up taking a lot of time.
Installing dependencies always requires an internet connection.
Upvotes: 7
Reputation: 4225
From Wikipedia: A package manager [...] is a collection of software tools that automates the process of installing, upgrading, configuring, and removing computer programs.
Instead of a complete computer program, you could also think of smaller parts like libraries, frameworks or just some a bunch of files packaged together.
While NuGet focusses mainly on .NET (there are a lot of non-.NET packages on NuGet however), NPM (Node Package Manager), Yarn and Bower are JavaScript package managers.
Yarn was created by Facebook and Open Sourced. Speed comparisons found online show that Yarn is faster than NPM. Yarn is also able to install packages from a cache and does not require a connection to the Internet (only if a package was downloaded before).
Grunt is a JavaScript Task Runner, not a package manager. You can use it to automate repetitive tasks like minification, compilation, unit testing, linting, etc.
Upvotes: 29