Skip to content

Instantly share code, notes, and snippets.

@yowainwright
Last active December 21, 2022 19:37
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yowainwright/e49bcbd66030e3f2c8ec104a0510f1ec to your computer and use it in GitHub Desktop.
Save yowainwright/e49bcbd66030e3f2c8ec104a0510f1ec to your computer and use it in GitHub Desktop.
NPM clutch cmds ✇

NPM clutch cmds ✇

  • clean cache

    Run an offline verification of existing cache contents

     npm cache verify

    Run cache clear for saving disk space purpose

     npm cache clean --force
  • remove files and re-install

    Run cmd to remove files

     rm -rf node_modules && npm i
  • rebuild node sass

    Run cmd to rebuild node-sass; often needed after removing, updating major changes to packages

     npm rebuild node-sass
  • view globally installed packages

    Run cmd to figure out what the heck is going on with globaly installed packages when seeing warnings/etc

     npm list -g --depth 0`
  • view package versions

    Run cmd to view package versions; often needed after Greenkeeper issues

     npm show <package>@* version
     # in example
     npm show glob@* version
  • get help when I forget part way through a cmd

    Run cmd when a cmd is being typed but the executor (a human typing in a shell) forgets the rest or the cmd or does not know the rest of the cmd

     npm <cmd> --help
     # in example
     npm run --help # joke intended
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment