List globally installed npm packages
Read-only
What do risk levels mean?
- Read-only
- Inspects state without changing anything.
- Low risk
- Reversible with a routine follow-up command.
- Medium risk
- Changes state; undo path documented.
- Destructive
- Deletes or overwrites; confirmation required.
Shows every package installed globally for the active Node.js version and where they live on disk, useful before upgrades or when a CLI is missing.
nodenpmglobalpackages
Commands
List top-level globally installed packages
npm ls -g --depth=0Show the directory global packages are installed into
npm root -gVerification
npm ls -g --depth=0A tree of globally installed packages for the active Node.js version.
Undo
Not undoable
This recipe only reads installed package information and changes nothing.
Pitfalls
- Global packages are per Node.js version — switching versions with a version manager gives you a different (possibly empty) global set.
- A CLI that is "installed but not found" usually means the global bin directory is not on the PATH; compare with npm prefix -g.