NPM Init:
For create Package.json file which would recode the dependence.
NPM Install:
You can also write like:
This is a shortcut-to-write NPM install.
For example. We want to install Undersocre.js
NPM Install-s Underscore
The '-s ' works is it would write down the dependence into the Package.json we just create:
{ "name":"commonjsbroswerfiy", "version":"0.0.0", "Description":"", "Main":"Index.js", "Scripts": { "Test":"echo \ "Error:no test specified\" && exit 1" }, "author":"", "License":"MIT", "Dependencies": { "Underscore":"^1.7.0" }}
Dev-dependence:
Install -D Bower
'-d ' is-add dependence into devdependence which only available for the co-work.
{ "name":"commonjsbroswerfiy", "version":"0.0.0", "Description":"", "Main":"Index.js", "Scripts": { "Test":"echo \ "Error:no test specified\" && exit 1" }, "author":"", "License":"MIT", "Dependencies": { "Underscore":"^1.7.0" }, "devdependencies": { "Bower":"^1.3.12" }}
If we have Package.json, the other people download our project and they just need to run:
NPM I
They can install all the dependence.
[node. js] NPM init && npm Install