Skip to content

Instantly share code, notes, and snippets.

@gokulkrishh
Last active September 18, 2024 07:02
Show Gist options
  • Save gokulkrishh/af774c9aed9b05cccab6fd6a4ebba172 to your computer and use it in GitHub Desktop.
Save gokulkrishh/af774c9aed9b05cccab6fd6a4ebba172 to your computer and use it in GitHub Desktop.
List of useful npx (Node Package Runner) commands (https://git.io/useful-npx-commands)

NPX (NPM Package Runner) Commands

List of useful npx (NPM Package Runner) commands.

What is NPX?

Using NPX we can execute/run node binaries without the need to install it locally or globally.

Commands

Create local server

npx server <folder-name>

Format using prettier

npx pretty-quick --check # to check the no of files to be affected
npx pretty-quick # format all files shown in check

Show system info, browsers installed, binaries like node, npm, yarn and npm packages installed in local & globally

npx envinfo

To show system info and show specific npm packages info

npx envinfo --preset <package-name>

Run a json server with .json file.

npx json-server <json-file-link> # We can even using json file from git gist

Sort package.json file.

npx sort-package-json

Check for node module updates and update them interactively in command line

npx npm-upgrade

Get the package version information in command line

npx gvi <package-name>

Set any macOS browser as default browser via cli

npx set-default-browser <browser-name>

Add license, code of conducts, gitignore

npx license mit > LICENSE.md  # initialize your license
npx gitignore node  # initialize your gitignore
npx covgen YOUR_EMAIL_ADDRESS # code of conduct

Delete node_modules

npx npkill
npx npkill --sort "size"

TLDR of popular methods of cli tools/packages

npx tldr <npm-pkg-or-cli-tool>
npx tldr yarn

View JSON from terminal (togglable)

npx fx <file.json>

Keycaster for Mac

npx macos-key-cast
@loehx
Copy link

loehx commented Apr 7, 2022

+1 awesome

@techwizard210
Copy link

awesome

@MsNicoleta
Copy link

Thank you :)

@Gits-hub
Copy link

super ++

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment