Skip to content

Instantly share code, notes, and snippets.

@rlugojr
Forked from AvnerCohen/npm-cheat-sheet.md
Created October 21, 2016 15:35
Show Gist options
  • Select an option

  • Save rlugojr/f5e8fa397d008649f106ff396011eaa2 to your computer and use it in GitHub Desktop.

Select an option

Save rlugojr/f5e8fa397d008649f106ff396011eaa2 to your computer and use it in GitHub Desktop.

Revisions

  1. @AvnerCohen AvnerCohen revised this gist Jun 9, 2016. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions npm-cheat-sheet.md
    Original file line number Diff line number Diff line change
    @@ -96,10 +96,10 @@ npm config set editor "sublime"
    npm publish --tag beta
    ```
    ######Show the full dependency tree
    ######Test & Show the full dependency tree
    ```
    npm ls
    npm install --dry-run
    ```
    ######List outdated libraries compared to currently installe node_modules:
  2. @AvnerCohen AvnerCohen revised this gist Jun 9, 2016. 1 changed file with 6 additions and 0 deletions.
    6 changes: 6 additions & 0 deletions npm-cheat-sheet.md
    Original 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:
    ```
  3. @AvnerCohen AvnerCohen revised this gist Nov 20, 2014. 1 changed file with 18 additions and 1 deletion.
    19 changes: 18 additions & 1 deletion npm-cheat-sheet.md
    Original 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
    ```
  4. @AvnerCohen AvnerCohen revised this gist Dec 12, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion npm-cheat-sheet.md
    Original file line number Diff line number Diff line change
    @@ -108,7 +108,7 @@ npm outdated
    npm shrinkwrap
    ```
    #####Install a git specific release
    ######Install a git specific release
    ```
    npm install git://github.com/Marak/colors.js#v0.6.0
  5. @AvnerCohen AvnerCohen revised this gist Dec 12, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion npm-cheat-sheet.md
    Original 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
    ######Prepand ./bin to your $PATH
    Make sure to export your local $PATH and prepand relative ./node_modules/.bin/:

    ````sh
  6. @AvnerCohen AvnerCohen revised this gist Dec 12, 2013. 1 changed file with 8 additions and 0 deletions.
    8 changes: 8 additions & 0 deletions npm-cheat-sheet.md
    Original 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.

  7. @AvnerCohen AvnerCohen revised this gist Dec 9, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion npm-cheat-sheet.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    Node.js npm Cheat Sheet
    Node.js - npm Cheat Sheet
    ===
    (Full description and list of commands at - https://npmjs.org/doc/index.html)

  8. @AvnerCohen AvnerCohen revised this gist Dec 9, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion npm-cheat-sheet.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    Node.js's npm Cheat Sheet
    Node.js npm Cheat Sheet
    ===
    (Full description and list of commands at - https://npmjs.org/doc/index.html)

  9. @AvnerCohen AvnerCohen revised this gist Dec 9, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion npm-cheat-sheet.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    NPM Cheat Sheet
    Node.js's npm Cheat Sheet
    ===
    (Full description and list of commands at - https://npmjs.org/doc/index.html)

  10. @AvnerCohen AvnerCohen revised this gist Dec 7, 2013. 1 changed file with 6 additions and 0 deletions.
    6 changes: 6 additions & 0 deletions npm-cheat-sheet.md
    Original 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
    ```
  11. @AvnerCohen AvnerCohen revised this gist Nov 25, 2012. 1 changed file with 14 additions and 2 deletions.
    16 changes: 14 additions & 2 deletions npm-cheat-sheet.md
    Original 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 NPM commands

    ##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
    ```
  12. @AvnerCohen AvnerCohen revised this gist Nov 12, 2012. 1 changed file with 7 additions and 1 deletion.
    8 changes: 7 additions & 1 deletion npm-cheat-sheet.md
    Original 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
    ```
  13. @AvnerCohen AvnerCohen revised this gist Nov 10, 2012. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions npm-cheat-sheet.md
    Original 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
    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"
    ```
    ```
  14. @AvnerCohen AvnerCohen created this gist Nov 10, 2012.
    83 changes: 83 additions & 0 deletions npm-cheat-sheet.md
    Original 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"
    ```