lib/plugins/plugin/install/install.js/PluginInstall/pluginInstall
class PluginInstall:  pluginInstall() {
    const servicePath = this.serverless.config.servicePath;
    const packageJsonFilePath = path.join(servicePath, 'package.json');

    return fileExists(packageJsonFilePath).then(exists => {
      // check if package.json is already present. Otherwise create one
      if (!exists) {
        this.serverless.cli
          .log('Creating an empty package.json file in your service directory');

        const packageJsonFileContent = {
          name: this.serverless.service.service,
          description: '',
          version: '0.1.0',
          dependencies: {},
          devDependencies: {},
        };
        return fse.writeJsonAsync(packageJsonFilePath, packageJsonFileContent);
      }
      return BbPromise.resolve();
    })
    .then(() => {
      // install the package through npm
      const pluginFullName = `${this.options.pluginName}@${this.options.pluginVersion}`;
      const message = [
        `Installing plugin "${pluginFullName}"`,
        ' (this might take a few seconds...)',
      ].join('');
      this.serverless.cli.log(message);
      return this.npmInstall(pluginFullName);
    });
  }