← coderrocketfuel.com

Get the Location of Globally Installed NPM Packages

How can you get the location on your machine where globally installed NPM packages are located?

Open a terminal window and execute this command:

npm root -g

That command will output the location of the node_modules directory where your global NPM packages are installed.

As an example, here's what's outputted on my machine:

/Users/nick/.nvm/versions/node/v18.12.1/lib/node_modules

Yours may be slightly different.

Thanks for reading and happy coding!