How does the module installed in node work?

  node.js, question
  1. I am herecmdImplementation in insidenpm install --global gulpThisnpmIt should be stored in win environment variables. The command line found the corresponding command, executed the program corresponding to the following parameters, and downloaded itgulp. Then I will execute it nowgulp, he ran up, this is a what process?

  2. package.json,webpack.config.js,gulpfile.babel.js, what is the relationship between, how to call?

In order towindowsFor example, you installednode.jsAndnpmWhen, will put this directoryC:\Users\yourname\AppData\Roaming\npmAdd to the environment variable, andnpm install -g gulpWill be generated in this directorygulp.cmdDocuments.
So you type at the command linegulpThis was actually implementedgulp.cmdFile, and thisgulp.cmdThe order inside is to executenode_modulesUnder the directorygulpCorrespondingcliFile, and then began to rungulpThe script.
linuxAndmacThe principle is the same as this.

package.jsonYesnode.jsDescription file of the project, defining information such as project name/dependency package/startup command, etc.
webpack.config.jsYeswebpackThe default name of the configuration file is this name. You can change it to another name and specify it through command line parameters.
gulpfile.babel.jsShould be usedes6WrittengulpfileScript, need to passbabelConversion.