我想将文本转换为语音,将语音转换为文本。为此,我使用了。文本到语音是工作的,当我在同一个项目中安装@google/ speech和@google/文本到语音库时,fine.But到Text是行不通的。我知道库的依赖关系之间存在冲突,但无法找到解决方案。
错误日志:
{ 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);请帮我解决这个问题
发布于 2020-06-26 18:15:42
问题是,我在两个包中使用相同的key.json文件,我通过创建密钥文件的副本并初始化它来解决这个问题。
发布于 2022-05-18 14:16:37
我面临这个错误,它只是更新您的包和检查的兼容性(google core,,.)
https://stackoverflow.com/questions/62592427
复制相似问题