Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Local versus global packages for Angular development

When developing with Angular, one can

npm install

to install packages locally, or

npm install -g

to install them globally. I am wondering what are the implications of each practice. And what happens if a particular package is installed both ways, perhaps with different versions? Which one will my Angular app use?

like image 691
William Jockusch Avatar asked Nov 19 '25 00:11

William Jockusch


1 Answers

From there https://www.quora.com/When-do-I-install-a-package-locally-or-globally-in-NPM

In general, the rule of thumb is:
1. If you’re installing something that you want to use in your program, using import { 'whatever'}, then install it locally, at the root of your project.
2. If you’re installing something that you want to use in your shell, on the command line or something, install it globally, so that its binaries end up in your PATH environment variable.

like image 164
Serhii Havrylenko Avatar answered Nov 22 '25 05:11

Serhii Havrylenko



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!