DEV Community

Ushahemba Shir
Ushahemba Shir

Posted on

Difference between devDependencies and Dependencies.

The difference between these two, is that devDependencies are modules which are only required during development, while dependencies are modules which are also required at runtime.
To save a dependency as a devDependency on installation we need to do an npm install --save-dev, instead of just an npm install --save.
https://medium.com/@dylanavery720/npmmmm-1-dev-dependencies-dependencies-8931c2583b0c#:~:text=The%20difference%20between%20these%20two,an%20npm%20install%20%2D%2Dsave.

Latest comments (5)

Collapse
 
krizna99 profile image
Krizna-99

Actually there are four types prod, dev, optional and no save.

Collapse
 
rsa profile image
Ranieri Althoff • Edited

Also peer and bundled

Collapse
 
ushashir profile image
Ushahemba Shir

Dear Krizna-99, kindly explain optional and no save.

Collapse
 
krizna99 profile image
Krizna-99 • Edited

If package is installed in optional dependency it will not produce error while npm install your project on other system and also it will not block your installation if anyone of the package didn't install properly.no save doesn't add your package to package.json

Thread Thread
 
ushashir profile image
Ushahemba Shir

Okay. Thank you very much for the clarifications. Much appreciated.