将angular 5与ElasticSearch连接时,获取过程未定义错误?

将angular 5与ElasticSearch连接时,获取过程未定义错误?,
Warning: implode(): Invalid arguments passed in /data/phpspider/zhask/webroot/tpl/detail.html on line 45
,,这是我第一次使用angular with elastic,我在“this.client=new client(//…”一行中得到了上述错误 精确误差 ReferenceError:未定义进程 在Log.push../node_modules/elasticsearch/src/lib/Log.js.Log.addOutput(Log.js:213)处 在新日志中(Log.js:51) 在新运输公司(Transport.js:19) 在新的eSapClient(client.js:58) 在新客户

这是我第一次使用angular with elastic,我在“this.client=new client(//…”一行中得到了上述错误

精确误差

ReferenceError:未定义进程 在Log.push../node_modules/elasticsearch/src/lib/Log.js.Log.addOutput(Log.js:213)处 在新日志中(Log.js:51) 在新运输公司(Transport.js:19) 在新的eSapClient(client.js:58) 在新客户端(Client.js:101) 在ElasticsearchService.push../src/app/elasticsearch.service.ts.ElasticsearchService.connect(elasticsearch.service.ts:23) 在新的ElasticsearchService上(elasticsearch.service.ts:18) at_createClass(core.js:9260) at_createProviderInstance$1(core.js:9234) 在resolveNgModuleDep(core.js:9200)

这是相关代码

import { Client } from 'elasticsearch';
import { Injectable } from '@angular/core';

@Injectable()
export class ElasticsearchService {

  private client: Client;

  queryalldocs = {
    'query': {
      'match_all': {}
    }
  };

  constructor() {
    if (!this.client) {
      this.connect();
    }
  }

  private connect() {
    this.client = new Client({
      host: 'http://localhost:9200',
      log: 'trace'
    });
  }

重新安装模块解决了问题。不知道是什么首先破坏了安装。

我发现有几个线程,下面的命令对我有效

然后将下面两行添加到polyfill.ts文件中

 import * as process from 'process';
 window['process'] = process;

你能告诉我你是如何解决这个问题的吗?你说的“重新安装模块解决了这个问题”是什么意思?如何解决?提前感谢希望不会太晚,重新安装elasticsearch.js应该可以
 import * as process from 'process';
 window['process'] = process;