DEV Community


Useful NPX

Samuel Beard
・1 min read

You probably use, or at least have heard of, npx if you work with Javascript. If not, look it up. It's really handy.

Here are some commands I run on the reg with npx:

npx okimdone npm install

If you have your volume up, a voice will tell you when the command you entered is done. It's really handy for tasks that take ages but want to come back to after.

npx npm-check

# Options
-u - Interactive Updates
-y - Update everything
-s - Skip unused
-g - Global

Checks your installed npm packages and gives you info about them. It's great for seeing if you have stuff in your package.json that your aren't actually using in your app.

Running npx npm-check -su will simply update all of your packages.

npx npkill

Run this from the folder that holds all of your projects. It will list out every node_modules folder from there along with the amount of disc space it is using. You can then go through them and delete the node_modules folders individually by hitting the space bar.

npx generact

If you are creating components for react, this is really useful.

Generact will duplicate a component you already have made and give it a new name. It will copy the old components file structure and change the component name anywhere it is written inside it.

npx samuelbeard

Just thought this was neat.

If you know of any more npx tools that are super useful, bung em in the comments.

Discussion (0)