简体   繁体   中英

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

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

  1. Using npm install express - either from package.json or via command line. This method will install express locally in your node_modules folder.
  2. Using npm install express -g . This method installs the package globally on your machine.

I was just wondering what the benefits were to using either method. Is either one considered "best practice" over the other?

For creating an app, you should always install it locally. This will allow you to use different express version for each app you make.

Installing express globally will allow you to use the express command line utility to create boilerplate code and stuff. So ideally, you should install express in both places, but make sure the app you develop run on the local version.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM