This documentation answers my question very poorly. I didn\'t understand those explanations. Can someone say in simpler words? Maybe with examples if it\'s hard to choose si
These are the packages that your package needs to run, so they will be installed when people run
npm install PACKAGE-NAME
An example would be if you used jquery in your project. If someone doesn't have jquery installed, then it wouldn't work. To save as a dependancy, use
npm install --save
These are the dependancies that you use in development, but isn't needed when people are using it, so when people run npm install
, it won't install them since the are not necassary. For example, if you use mocha to test, people don't need mocha to run, so npm install
doesn't install it. To save as a dev dependancy, use
npm install PACKAGE --save-dev
These can be used if you want to create and publish your own library so that it can be used as a dependency. For example, if you wan't your package to be used as a dependancy in another project, then these will also be installed when someone install's the project which has your project as a dependancy. Most of the time you won't use peer dependancies.