code: @Override
      public Collection<AgentProjectInfo> collectDependencies(String rootDirectory) {
          Collection<DependencyInfo> dependencies = new ArrayList<>();
          try {
              CommandLineProcess npmLsJson = new CommandLineProcess(rootDirectory, getLsCommandParamsJson());
              npmLsJson.setTimeoutReadLineSeconds(this.npmTimeoutDependenciesCollector);
              List<String> linesOfNpmLsJson = npmLsJson.executeProcess();
              // flag that indicates if the 'npm ls' command failed
              this.npmLsFailureStatus = npmLsJson.isErrorInProcess() && !this.ignoreNpmLsErrors;
              StringBuilder json = new StringBuilder();
              for (String line : linesOfNpmLsJson) {
                  json.append(line);
              }
              if (json != null && json.length() > 0 && (!npmLsJson.isErrorInProcess() || this.ignoreNpmLsErrors)) {
                  logger.debug("'npm ls' output is not empty");
                  if(npmLsJson.isErrorInProcess() && this.ignoreNpmLsErrors) {
                      logger.info("Ignore errors of 'npm ls'");
                  }
                  getDependencies(new JSONObject(json.toString()), rootDirectory, dependencies);
              }
          } catch (IOException e) {
              this.npmLsFailureStatus = true;
              logger.warn("Error getting dependencies after running 'npm ls --json' on {}, error : {}", rootDirectory, e.getMessage());
              logger.debug("Error: {}", e.getStackTrace());
          }
  
          if (dependencies.isEmpty()) {
              if (!showNpmLsError && this.npmLsFailureStatus) {
                  logger.warn("Failed to getting dependencies after running '{}', run {} on {} folder", getLsCommandParams(), getInstallParams(), rootDirectory);
                  showNpmLsError = true;
              }
          }
          return getSingleProjectList(dependencies);
      }
docs: /* --- Public methods ---