---
title: "Terminal: npm"
description: "Notice: This is a little \"terminal treat\" – a short tip rather than a whole article. Enjoy!"
date: 2026-05-11
canonical_url: "https://christofersandin.com/texts/npm"
section: "Texts"
---

#  Terminal: npm 

**Notice: This is a little "terminal treat" – a short tip rather than a whole article. Enjoy!**

**Working in the terminal with web development, you’ll likely be running into Node and the Node Package Manager (npm) sooner or later. It’s a standardized way to install and use JavaScript-based software — here’s a summary of some useful commands.**

Packages can be installed globally or per project.

## Global packages

- List all globally installed packages  
    `npm list -g --depth=0`
- You can check for a particular module installed globally. This is particularly useful when checking what version of a module you are using globally (remove the `-g` flag if checking a local module):  
    `npm list -g --depth=0 | grep <module_name>`

## Packages

- If you’d like to see all available (remote) versions for a particular module, then do:  
    `npm view <module_name> versions`.  
    Note that *versions* is in the plural. This will give you a complete listing of versions to choose from.
- For the latest remote version:  
    `npm view <module_name> version`   
    Note that the *version* is singular.
- To find out which packages need to be updated, you can use  
    `npm outdated -g --depth=0`
- To update global packages, you can use  
    `npm install -g <package>`
- To update all global packages, you can use:  
    `npm update -g`

Another way would be to use `npm-check-updates` (or `ncu` for short).

## References

- [Node](https://nodejs.org/)
- [npm](https://www.npmjs.com/)
- [npm-check-updates](https://www.npmjs.com/package/npm-check-updates)
- [npm-outdated](https://docs.npmjs.com/cli/v11/commands/npm-outdated/) in the official npm Docs
- [Updating packages downloaded from the registry](https://docs.npmjs.com/updating-packages-downloaded-from-the-registry/) in the official npm Docs
- [npm cheatsheet](https://devhints.io/npm) by devhints.io
- [Better NPM’ing, Tips and Tricks using NPM](http://www.tomsquest.com/blog/2018/10/better-npm-ing) by Tom’s Quest

---

## Metadata

  [\#terminal-treats](/writing/terminal-treats)

 Published .  
 Last modified .

 3 7 10 256
