NPM Cheat Sheet === (Full description and list of commands at - https://npmjs.org/doc/index.html) ##List of less common (however useful) NPM commands ######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 ``` ######Generate package.json in a module directory, based on npm parmaters. ``` npm init ``` ######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 ``` ######Display the readme.md / documentation / npmjs.orf page of a give library. ``` npm docs ``` ######Run package test suite, based on setup in package.json in: ``` "scripts" : {"test" : "node testfile.js"} ``` ``` npm test ``` ######Uninstall package (A nice thing about npm is you can always just ```rm -rf ./node_modules/```). ``` npm uninstall ``` ######Locally edit a dependency. ``` npm edit ``` ######Setup editor for ```npm edit ``` : ``` npm config set editor "sublime" ``` ######Publish a package not under the default "latest" tag: ``` npm publish --tag beta ``` ######List outdated libraries compared to currently installe node_modules: ``` npm outdated ``` ######Lock down dependency versions: ``` npm shrinkwrap ``` #####Install a git specific release ``` npm install git://github.com/Marak/colors.js#v0.6.0 ```