If you’re familiar with nodejs & npm you already know this (just skip this part), but newcomers should realize that npm packages can not only be installed locally in a project’s folder, but also globally. Packages that are installed globally are.. globally accessible, which is really cool because using npm you can install many CLI tools to streamline your workflow and boost your productivity.
To install a package globally, you simply need to use the –global (-g) flag. For example:
npm install --global gulp
Note that you can customize where npm stores globally installed packages by creating a .npmrc file in your home folder and adding the following to it:
You then simply have to add that same path to your system’s path to get all the tools available at your fingertips.
Here’s a small list of npm packages that I currently install globally
- gulp: Streaming build system for the web!
- babel: JS transpiler. Because we all want ES2015/2016/20xy right now!
- typescript: Ahhh TypeScript, worth explaining in its own post because strongly typed JS is the future and the future is now
- tsd: TypeScript type definitions downloader. Because TypeScript without type definitions isn’t very useful
- brower-sync: Easy to use web server that will make your developer life easier: automatically refresh/sync across all connected devices
- http-server: Minimalist web server (zero-configuration). Using this you can easily serve local content
- sass: CSS preprocessor (also deserves its own post). Until I free up some time to learn more about PostCSS, I’ll continue to use this
- node-sass: SASS without Ruby, weeee
- yo: CLI to run Yeoman generators
- slush: Another scaffolding CLI (based on Gulp)
- caniuse-cmd: CLI to easily check browser compatibility of certain features using data from caniuse.com
- reveal-md: Quickly generate a reveal.js presentation from markdown content
- superstatic: Nice web server for SPAs
- bower: Package manager for the web. I install it for older projects
- grunt: Task runner for the web. Same as above
- node-inspector: Blink-based debugger for NodeJS apps
- node-debug: Wrapper for node-inspector
- speed-test: Test the speed of your Internet connection
- semantic-release-cli: Ease your life when creating new releases
- npm-bump: Another alternative for easy releases
- center-code: a simple way to show file contents in the console
- npm-check: check for outdated dependencies
- rimraf: easily delete files (even paths that are too long on Windows)