Show all globally installed npm packages with linked modules highlighted

I need help finding a way to display all npm packages that are installed globally on my system. What I really want is to see which ones are connected to local development folders using the link command.

Is there a way to get a complete list that shows:

  • All global npm installations
  • Which packages are linked to local directories
  • The actual file paths for the linked ones

I’ve been working on multiple projects and lost track of what I have linked where. It would be great if there’s a single command that can show me everything at once, maybe with some kind of marker or flag to identify the linked packages from the regular global installs.

Just run npm ls -g - it’s the clearest way to see what’s going on. Linked packages show up differently - you’ll see the actual filesystem path instead of just the package name. Found this out the hard way when debugging TypeScript issues that were actually caused by symlinks I’d forgotten about. The command also flags broken links as missing dependencies, which is great for cleanup. Want a cleaner format? Add --json and parse it however you want. This has saved me tons of time when switching dev environments and wondering why packages are acting weird.

Use npm list -g --depth=0 to see all your global packages. Linked packages show up with a symlink arrow pointing to where they actually live on your system. I figured this out after getting confused in multiple React projects where I’d forgotten what was linked vs installed normally. Want more details? Try npm list -g --depth=0 --parseable for raw file paths. Linked packages are easy to spot - they show the full local path instead of the usual node_modules location. I usually pipe it to grep when I’m hunting for linked packages specifically, but the regular output makes them obvious enough.

use npm ls -g --depth=0 --link=true for linked packages only. and run npm config get prefix to see where your global stuff is. the link flag saves a lot of time when u have so many global modules!

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.