Difference between dependencies, devDependencies and peerDependencies in Node.js

dependencies

dependencies are installed on package.json and any other directory using

npm install.

devDependencies

devDependencies are installed on

npm install 
on the directory that contain package.json file only if you don’t pass the –production flag. It is not installed on npm install “$package” on any other directories if you don’t give it a dev option. DevDependencies are not installed transitively. You you are an end user who wants to install a package install using npm install “$package” . In this case you don't need development dependencies, so get what is needed to use package: dependencies. If you want to install development packages set the dev configuration option to true.

npm install “$package” --dev

PeerDependencies

If multiple versions of dependency is used by various dependencies it will show an error. It is installed only if missing. Plugins are the packages that don’t require other packages which are called host. In peerDependency plugins are required by the host. The first example of peerDependency is Grunt, the host and its plugins.

Transitivity

In this the dependencies are installed transitively i.e. you don't have to test A to test B.