【问题标题】:GRPC target method can\'t be resolved.-@google-cloud/speech APIGRPC 目标方法无法解析。-@google-cloud/speech API
【发布时间】:2020-10-16 22:03:06
【问题描述】:

我想将文本转换为语音并将语音转换为文本。我为此使用谷歌云 API。文本到语音工作正常。但是当我在同一个项目中安装 @google-cloud/speech 和 @google-cloud/text-to-speech 库时,语音到文本不起作用。我知道依赖项之间存在冲突的图书馆,但找不到解决方案。

错误日志:

{ Error: 12 UNIMPLEMENTED: GRPC target method can't be resolved.
    at Object.callErrorFromStatus (SampleNodeJs\node_modules\@grpc\grpc-js\build\src\call.js:30:26)
    at Object.onReceiveStatus (SampleNodeJs\node_modules\@grpc\grpc-js\build\src\client.js:175:52)
    at Object.onReceiveStatus (SampleNodeJs\node_modules\@grpc\grpc-js\build\src\client-interceptors.js:341:141)
    at Object.onReceiveStatus (SampleNodeJs\node_modules\@grpc\grpc-js\build\src\client-interceptors.js:304:181)
    at Http2CallStream.outputStatus (SampleNodeJs\node_modules\@grpc\grpc-js\build\src\call-stream.js:116:74)
    at Http2CallStream.maybeOutputStatus (\node_modules\@grpc\grpc-js\build\src\call-stream.js:155:22)
    at Http2CallStream.endCall (\SampleNodeJs\node_modules\@grpc\grpc-js\build\src\call-stream.js:141:18)
    at Http2CallStream.handleTrailers (/SampleNodeJs\node_modules\@grpc\grpc-js\build\src\call-stream.js:273:14)
    at ClientHttp2Stream.emit (events.js:189:13)
    at emit (internal/http2/core.js:236:8)
  code: 12,
  details: 'GRPC target method can\'t be resolved.',
  metadata: Metadata { internalRepr: Map {}, options: {} },
  note:
   'Exception occurred in retry method that was not classified as transient' }

Package.json

{
  "name": "samplenodejs",
  "version": "1.0.0",
  "description": "",
  "main": "Server.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start": "node server.js"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "@google-cloud/speech": "^4.1.0",
    "@google-cloud/text-to-speech": "^3.0.0",
    "express": "^4.17.1",
    "http": "0.0.1-security"
  }
}

包初始化:

  // Creates a client
    const appConfig= {
        projectId: 'ssssssssssss',
        keyFilename: './key.json'
    }
const client = new textToSpeech.TextToSpeechClient(appConfig);

// Creates a client
    const client = new speech.SpeechClient(appConfig);

请帮我解决这个问题

【问题讨论】:

    标签: node.js speech-to-text google-api-nodejs-client google-cloud-speech


    【解决方案1】:

    问题是,我对两个包都使用了相同的 key.json 文件。我通过创建密钥文件的副本并对其进行初始化来解决它

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-04-13
      • 2018-11-30
      • 2019-01-02
      • 1970-01-01
      • 2017-11-01
      • 1970-01-01
      相关资源
      最近更新 更多