Last active
August 28, 2025 08:29
-
Star
(249)
You must be signed in to star a gist -
Fork
(53)
You must be signed in to fork a gist
-
-
Save AvnerCohen/4051934 to your computer and use it in GitHub Desktop.
Revisions
-
AvnerCohen revised this gist
Apr 13, 2023 . 1 changed file with 20 additions and 20 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,9 +2,9 @@ Node.js - npm Cheat Sheet === (Full description and list of commands at - https://npmjs.org/doc/index.html) ## List of less common (however useful) NPM commands ###### Prepand ./bin to your $PATH Make sure to export your local $PATH and prepand relative ./node_modules/.bin/: ````sh @@ -13,57 +13,57 @@ export PATH="$PATH:./node_modules/.bin" This will allow executing npm binaries installed into the .bin local and isolated current ./node_modules ###### Install a package and also update package.json with the installed version and package name. ``` npm install <module-name> --save ``` ###### Install a package and also update package.json with the installed version and package name, but into the devDependencies section. ``` npm install <module-name> --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 <module-name> ``` ###### Run package test suite, based on setup in package.json in: ``` "scripts" : {"test" : "node testfile.js"} ``` @@ -72,55 +72,55 @@ npm docs <module-name> npm test ``` ###### Uninstall package (A nice thing about npm is you can always just ```rm -rf ./node_modules/<module_name>```). ``` npm uninstall <module_name> ``` ###### Locally edit a dependency. ``` npm edit <module_name> ``` ###### Setup editor for ```npm edit ``` : ``` npm config set editor "sublime" ``` ###### Publish a package not under the default "latest" tag: ``` npm publish --tag beta ``` ###### 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 ``` ###### Install a git specific release ``` npm install git://github.com/Marak/colors.js#v0.6.0 ``` ###### Easter Eggs ``` npm xmas -
AvnerCohen revised this gist
Jun 9, 2016 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -96,10 +96,10 @@ npm config set editor "sublime" npm publish --tag beta ``` ######Test & Show the full dependency tree ``` npm install --dry-run ``` ######List outdated libraries compared to currently installe node_modules: -
AvnerCohen revised this gist
Jun 9, 2016 . 1 changed file with 6 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -96,6 +96,12 @@ npm config set editor "sublime" npm publish --tag beta ``` ######Show the full dependency tree ``` npm ls ``` ######List outdated libraries compared to currently installe node_modules: ``` -
AvnerCohen revised this gist
Nov 20, 2014 . 1 changed file with 18 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -112,4 +112,21 @@ npm shrinkwrap ``` npm install git://github.com/Marak/colors.js#v0.6.0 ``` ######Easter Eggs ``` npm xmas ``` ``` npm visnup ``` ``` npm substack ``` -
AvnerCohen revised this gist
Dec 12, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -108,7 +108,7 @@ npm outdated npm shrinkwrap ``` ######Install a git specific release ``` npm install git://github.com/Marak/colors.js#v0.6.0 -
AvnerCohen revised this gist
Dec 12, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,7 +4,7 @@ Node.js - npm Cheat Sheet ##List of less common (however useful) NPM commands ######Prepand ./bin to your $PATH Make sure to export your local $PATH and prepand relative ./node_modules/.bin/: ````sh -
AvnerCohen revised this gist
Dec 12, 2013 . 1 changed file with 8 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,6 +4,14 @@ Node.js - npm Cheat Sheet ##List of less common (however useful) NPM commands ##### Prepand ./bin to your $PATH Make sure to export your local $PATH and prepand relative ./node_modules/.bin/: ````sh export PATH="$PATH:./node_modules/.bin" ```` This will allow executing npm binaries installed into the .bin local and isolated current ./node_modules ######Install a package and also update package.json with the installed version and package name. -
AvnerCohen revised this gist
Dec 9, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ Node.js - npm Cheat Sheet === (Full description and list of commands at - https://npmjs.org/doc/index.html) -
AvnerCohen revised this gist
Dec 9, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ Node.js npm Cheat Sheet === (Full description and list of commands at - https://npmjs.org/doc/index.html) -
AvnerCohen revised this gist
Dec 9, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ Node.js's npm Cheat Sheet === (Full description and list of commands at - https://npmjs.org/doc/index.html) -
AvnerCohen revised this gist
Dec 7, 2013 . 1 changed file with 6 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -98,4 +98,10 @@ npm outdated ``` npm shrinkwrap ``` #####Install a git specific release ``` npm install git://github.com/Marak/colors.js#v0.6.0 ``` -
AvnerCohen revised this gist
Nov 25, 2012 . 1 changed file with 14 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,8 +1,8 @@ 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. @@ -87,3 +87,15 @@ npm config set editor "sublime" ``` npm publish --tag beta ``` ######List outdated libraries compared to currently installe node_modules: ``` npm outdated ``` ######Lock down dependency versions: ``` npm shrinkwrap ``` -
AvnerCohen revised this gist
Nov 12, 2012 . 1 changed file with 7 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -80,4 +80,10 @@ npm edit <module_name> ``` npm config set editor "sublime" ``` ######Publish a package not under the default "latest" tag: ``` npm publish --tag beta ``` -
AvnerCohen revised this gist
Nov 10, 2012 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -40,7 +40,7 @@ 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. @@ -80,4 +80,4 @@ npm edit <module_name> ``` npm config set editor "sublime" ``` -
AvnerCohen created this gist
Nov 10, 2012 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,83 @@ NPM Cheat Sheet === ##List of less common NPM commands ######Install a package and also update package.json with the installed version and package name. ``` npm install <module-name> --save ``` ######Install a package and also update package.json with the installed version and package name, but into the devDependencies section. ``` npm install <module-name> --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 [email protected]: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 <module-name> ``` ######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/<module_name>```). ``` npm uninstall <module_name> ``` ######Locally edit a dependency. ``` npm edit <module_name> ``` ######Setup editor for ```npm edit ``` : ``` npm config set editor "sublime" ```