What is a difference between installing npm module locally and globally?

Experience Level: Senior
Tags: npm

Answer

When you install a module locally: 

  • It will be installed into your local folder.
  • The module is then not visible outside of this folder.
  • You can have multiple installations of the same module in different folders.
  • You can install different versions of the same module side by side.

When you install a module globally:

  • It can be used from all the other directories.
  • Only one version of the module can be installed.
  • You should install a module globally when you want to use it in multiple different projects without having a maintenance overhead.

Comments

No Comments Yet.
Be the first to tell us what you think.
npm for beginners
npm for beginners

Are you learning npm ? Try our test we designed to help you progress faster.

Test yourself