NPM Commands

NPM Commands

Generate package.json in a module directory, based on npm parmaters.


npm init

#Install a package and also update package.json with the installed version and package name.
npm install  --save

#Install a package and also update package.json with the installed version and package name, but into the devDependencies section.
npm install  --save-dev

#Set --save as a default for npm install
npm config set save true

#List all npm configuration flags.
npm config ls -l

#install a version not from a git repository and not from the npm directory, for example:
npm install git://github.com/substack/node-browserify.git

#Update the global npm version.
npm update npm -g

#Uninstall package (A nice thing about npm is you can always just rm -rf ./node_modules/).
npm uninstall 

#Test & Show the full dependency tree
npm install --dry-run

#List outdated libraries compared to currently installe node_modules:
npm outdated

#Lock down dependency versions:
npm shrinkwrap

#Easter Eggs
whatever-smiley
npm xmas
npm visnup
npm substack