What are the benefits of installing Express.js locally and globally

As I understand it, there are two ways to install Express.js.

  • Using npm install express - either from package.json or via the command line. This method will be locally installed in your node_modules folder.
  • Using npm install express -g . This method installs the package worldwide on your computer.

I'm just wondering what the benefits were when using any method. Is one of them a β€œbest practice” over the other?

+4
source share
1 answer

To create an application, you should always install it locally. This will allow you to use a different express version for each of your applications.

Installing express globally allows you to use the express command-line utility to create template code, etc. Therefore, ideally, you should install express in both places, but make sure that the application you are developing runs in the local version.

+7
source

All Articles