The Best of "npm install -g"

16,447 reads

@ transitive-bullshit Travis Fischer Saasify Founder & CEO

Working with Node.js, I commonly find myself switching between different versions with nvm . Regardless of the version, I maintain a script npm.sh , where I install a common list of globally useful CLIs.

I wanted to share this list of the best npm install -g CLIs out there so others will hopefully find them useful as well!

Here’s an overview of the list — if any of these look unfamiliar or perk your interest, I’d encourage you to check out their descriptions below. 👀

Get your global npm install on! 🔥🔥🔥

Working with NPM

nvm - Node version manager which allows you to install and manage multiple local Node.js versions.

NVM is an indispensable tool for package authors, as you’ll often need to switch between different versions of Node.js to ensure compatibility and debug issues.

yarn - A better package manager compatible with npm .

Although npm v5 is a lot faster than previous versions, I still find yarn to be preferable to npm for local development for its speed and consistency. Either way, you’re working with the same database of npm modules under the hood, and imho there’s no clear winner between the two. You should pick whichever package manager best suits your project’s needs.

As a JS developer in 2018, I would, however, make sure that you’re at least familiar with both npm and yarn and be comfortable switching off between them.

npx - Allows you to execute npm package binaries.

This is really one of my most-used Node.js-based CLIs. It helps you in a few areas:

Run any CLI from npm without having to install it globally.

Run locally-installed CLIs without having to reference ./node_mobules/.bin .

. Experiment with meta node and npm scripts by having npx temporarily install node itself!

Read more about npx here.

np - A better npm publish .

If you’re an npm author, I’d highly recommend checking out np, as it makes the process of bumping versions, adding git release tags, and publishing to npm a breeze, especially once you start having more than a couple of modules to maintain. It’s also worth noting release by Zeit as a solid alternative.

Image Credit: np by Sindre Sorhus

npm-name - Check whether a package name is available on npm.

Creating new npm packages gets to be a pretty common thing once you start developing open source with JavaScript, and I use this tool pretty often to quickly check if a given package name is available on npm.

Debugging

ndb - Improved debugger for Node.js via Chrome DevTools.

This debugging utility is very new, but I’ve already gotten so much usage out of it. In the past, debugging Node.js with node-inspector always just felt a bit heavyweight. NDB solves this and brings the same great debugging experience you’re used to from browser JavaScript to Node.js.

I can’t emphasize enough how awesome this tool is for debugging, and I’d encourage every Node.js developer out there to incorporate it into their development workflow.

General Utilities

tldr - Simplified, community-driven man pages.

Ever forget the syntax for a UNIX command? TLDR is perfect for this! It’s basically a modern take on old-school “man” help pages, and has really helped me to be a lot more productive on the command-line.

Image Credit: tldr

now - Extremely simple deployments.

Now is absolutely the best free deployment system that exists today in terms of simplicity, reliability, and feature set. It‘s great for testing static and dynamic deployments and scales up nicely if and when you require more servers. Aaaaaaaaaand did I mention that it’s free until you want to scale up?!

It plays extremely well with Node.js and JS-powered webapps. I’d also highly recommend checking out the rest of Zeit’s offerings as well, as their team is comprised by some of the best JS devs the community has to offer.

Image Credit: Zeit

spoof - Easily spoof your MAC address in macOS, Windows, & Linux!

This tool “just works” and is extremely useful for airports, hotels, and other times when the “man” is trying to restrict your internets.

fkill - Fabulously kill processes. Cross-platform.

Forget ps -ef | grep <name> && kill -9 XXX . This utility allows you to intuitively search and kill multiple processes at once.

Image Credit: fkill by Sindre Sorhus

castnow - Cast media to Chromecast from the command-line.

This is one of those utilities that works in a pinch. It’s a little difficult to fast-forward or rewind, and I generally prefer to use something more visual like Plex, but castnow has worked great for me from time to time.

github-is-starred - Check if a user has starred a particular GitHub repo.

This is a useful one-off utility that I frequently use to see if a user has starred a GitHub repository. Sometimes, if someone asks for help on a GitHub issue or thanks me for the project, I’ll do a quick check to see if they’ve starred the corresponding repo, and if not, throw in a “please star this repo to help others find it too.”

vtop - Visual command-line replacement for top .

Image Credit: vtop

React

create-react-app - The de facto standard React app builder.

Image Credit: imgflip meme generator

create-react-library - CRA’s younger cousin, allowing you to easily publish modern React libraries.

Create React Library (CRL) uses Create React App (CRA) under the hood. It allows you to easily create re-usable react components or component libraries that are publishable to npm. It supports all the features you’d expect and offers a ridiculously simple development and build process, piggy-backing off of CRA for local development and showcasing your library’s example usage.

react-native-cli - CRA for react native.

Image Credit: imgflip meme generator

Linting

eslint - A fully pluggable tool for identifying and reporting on patterns in JavaScript.

I use ale as a vim plugin to lint all JavaScript files with eslint by default. ESLint will default to these global configuration settings or be overridden by project-specific configs.

prettier - An opinionated code formatter.

Prettier enforces a consistent style by parsing your code and re-printing it with its own rules that take the maximum line length into account, wrapping code when necessary.

I love eslint and have been a long-time user of JavaScript Standard Style in particular, but the idea behind automatic code formatters like prettier and gofmt is undeniably attractive.

As developers, we spend way too much time and mental energy worrying about code presentation and styling, whereas prettier alleviates the need for those thought processes and allows you to focus on what you’re writing instead of how you’re writing it.

Image Credit: prettier

typescript - Very popular typed JavaScript variant.

What else is there to say other than TypeScript is eating the world?

Misc

These are tools I still install globally because they’re sometimes useful for working with older projects, but I rarely use them directly anymore.

gulp - Automate and enhance your workflow.

less - Superset of CSS.

Wrapping Up

I hope you’ve found this breakdown helpful, even if it’s just learning about one quality tool that you weren’t aware of before.

Have any favorite Node.JS CLI utilities that I left out? Let me know by sharing your favorites below in the comments! ❤️

Before you go…

If you liked this article, click the 👏 below, and share it with others so they can enjoy it as well.

Tags