September 09, 2018
One thing I keep googling is how to list my global npm modules. So for everybody who keeps forgetting this one-liner like me, here we go.
npm list -g --depth=0
Right now this gives me following result:
/usr/local/lib ├── firstname.lastname@example.org ├── email@example.com └── firstname.lastname@example.org
All of these modules are installed globally through npm into
/usr/local/lib/node_modules on Mac Os. To check the directory use
npm root -g
If you have installed global packages through Yarn, then these will not be in the same directory. I know a lot of people, me included, assume this at first.
Yarn (default) adds packages to
~/.config/yarn/global. To see which ones are installed globally use
yarn global list
Right now I get the following output:
info "email@example.com" has binaries: - create-react-app info "firstname.lastname@example.org" has binaries: - gatsby info "email@example.com" has binaries: - react-native