Npm vs Yarn

Both npm and Yarn are two well-known JavaScript package managers.  It  automates the process of installing, updating, configuring, and removing  packages retrieved from a global registry.

What is npm?

NPM basically is the package manager for node. It helps with installing various packages and resolving their various dependencies. It greatly helps with your Node development. NPM helps you install the various modules you need for your web development.The main goal, as you touched upon, is automated dependency and package management. This means that you can specify all of your project’s dependencies inside your package.json file, then any time you (or anyone else) needs to get started with your project they can just run npm installand immediately have all of the dependencies installed. On top of this, it is also possible to specify what versions your project depends upon to prevent updates from breaking your project.

What is Yarn?

Yarn is a JavaScript Package Manager, a direct competitor of npm, and it’s one of Facebook most popular Open Source projects.

It’s compatible with npm packages, so it has the great advantage of being a drop-in replacement for npm.

The reason you might want to use Yarn over npm are:

  • faster download of packages, which are installed in parallel
  • support for multiple registries
  • offline installation support
Comparing Yarn vs npm

Yarn has a few characteristics that set it apart from npm (especially version of npm previous to 5.0). A few of these include the following.

1.The yarn.lock File

Managing version numbers in package.json can get messy sometimes. However, the yarn.lock file helps alleviate the mess. Whenever you add a new module, Yarn updates a yarn.lock file. Similar to the Gemfile.lock feature in Ruby, the yarn.lock file ensures that the exact same package gets installed on every device. These lockfiles are called as such because they “lock” dependencies to their specific versions during installation. A lockfile consists of ordered keys to ensure minimal changes to the file structure in node_modules across all machines.

2.Package Installation

When installing a package, npm performs the necessary steps sequentially, meaning that each package must be fully installed before moving to the next. However, Yarn has the power to perform multiple installation steps at once, which drastically speeds up the process.

This is similar to the parallelism seen in HTTP/2.


Yarn was always much faster than any of the npm versions below 5.0. The team at npm announced that npm 5.0 would be 5x faster than its predecessor for certain operations. However, as shown by the results below from Scott Logic, Yarn still appears to be faster than npm 4 and 5 when testing with some fairly simple dependencies.

Furthermore, npm 5 doesn’t seem to provide much greater speeds than it’s predecessor. This may not mean much when you’re installing something like the gulp package, but it can make a huge difference in larger projects. Thanks to Yarn, bigger builds no longer necessarily entail longer build times.


A major problem with npm is that it automatically runs code from dependencies and permits packages to be added on the fly, While this feature comes with its conveniences, it also creates security vulnerabilities. Since Yarn only installs from your yarn.lock or package.json files, it’s considered to be more secure, which is increasingly important in today’s world. Yarn also makes use of checksums before installation to ensure the integrity of each package

Yarn vs Npm: Syntax
Yarn NPM
yarn: This command is used to install all the packages in a package.json file. npm install: This is used by NPM to install packages from the package.json file.
yarn run: This command is used to run script object specified in the package.json file. npm runnpm run is an alias for the command npm run-script, which does the same thing thing as its Yarn equivalent.
yarn add [package]: This command is used to install a package npm install [package]: This installs a package from NPM.
yarn remove [package]: This command is used to remove a package. npm uninstall [package]: This is the NPM equivalent for removing or uninstalling packages.
yarn version: This command is used to update the version of your application using semantic versioning. npm version: This command lists the version of your application, Node, NPM as well as other Node dependencies.
yarn upgrade: This command upgrade all the packages in the package.json file. NPM has an equivalent but is an installed package. [npm-upgrade](


React installation on Ubuntu 16.04

1.Install Git to get code from the various repository.

2. Take the pull from bitbucket and give the parent file in which express and react are downloaded, following commands:

Here user name is your system user name.

Here taking the git pull means cloning from bitbucket.For this you  need to go to express and react repositories on bitbucket and click on the clone button on topmost right side. It will give you link like this

Just copy this where ever you wanted to set up your project. Normally we do this here :

2. Node

First install curl

Node JS

Node.js is a platform built on Chrome’s JavaScript runtime for easily building fast, scalable network applications.


Npm is a package manager. Typically this software is installed to build Node applications.It let’s you install software (libraries, plugins, frameworks and applications).

This will install node and npm both.

To check the installed version :

3. Install node version manager

Note: On Linux, after running the install script, if you get nvm: command not found or see no feedback from your terminal after you type:

Close the terminal and open it again.

If you want to see what versions are installed:

To install a particular node version :

4. Mongo(This works like charm as official mongodb website key is not working)

Install mongo :

For starting mongod services :

To know current status :

5. Install yarn

6. Final step

Now just go to your express and react folders from command prompt and run


There are no more results.