What does the -g option do when running npm install?

looper003 asked this question 1 year, 5 months ago
looper003 on Dec 13, 2021

I've seen the npm install -g <package> command used in several different places, but can't figure out what the -g option does.

2 suggested answers
nick on Dec 22, 2021

That installs the package globally on your local machine, which means you can install the package anywhere.

For example, let's say you installed the nodemon NPM package globally on your machine:

npm install -g nodemon

You could then use it anywhere on your machine to run Node.js applications:

nodemon <your Node.js app>
0 replies
suparman21 on Dec 22, 2021

Installs a NPM package globally on your machine.

Read more about Global vs. Local installations.

0 replies