Where Does npm Store Global Packages and Cache?
npm global node_modules prefix and cache folder on Windows, macOS and Linux, with the commands that print them.
Last updated
npm splits global installs (the prefix) from its download cache. Both move with config, so docs disagree; the commands below print your live paths.
Global bins must sit on PATH or installs look broken. That missing PATH entry causes most command not found reports after a global install.
Where npm stores this, by platform
%APPDATA%\npm
Default global prefix on Windows. Cache defaults under %LOCALAPPDATA%\npm-cache. Print both with the prefix and cache path config commands.
/usr/local/lib/node_modules
Common Homebrew and installer default; nvm users get a versioned path under ~/.nvm instead. Cache sits under ~/.npm. Print live values rather than assuming.
~/.npm
Cache default. Global prefix varies by install method (distro, nvm, manual). The root and prefix commands print the truth for your setup.
Frequently asked questions
How do I print my npm global folder?
Ask npm for its root with the global flag and for its prefix. Those two answers cover binaries and modules for your install.
Is it safe to delete the npm cache?
Yes. The cache verify command checks integrity, and cache clean with force wipes it. Next install just re downloads.
Notice an outdated path? Let us know.