小编Ett*_*ini的帖子

@google-cloud/speech - 错误:ENOENT:没有这样的文件或目录,打开 'protos.json

我正在尝试使用谷歌云语音来文本 api。

我正在使用示例 google 代码,当我创建客户端对象时,出现此错误。

{ 
   "errno":-2,
   "syscall":"open",
   "code":"ENOENT",
   "path":"protos.json",
   "stack":"Error: ENOENT: no such file or directory, open 'protos.json'\n    at Object.openSync (fs.js:440:3)\n    at Object.readFileSync (fs.js:342:35)\n    at fetch (transcript-server-js/node_modules/protobufjs/src/root.js:160:34)\n    at Root.load (/transcript-server-js/node_modules/protobufjs/src/root.js:194:13)\n    at Root.loadSync (/transcript-server-js/node_modules/protobufjs/src/root.js:235:17)\n    at Object.loadSync (/transcript-server-js/node_modules/@grpc/proto-loader/build/src/index.js:221:27)\n    at GrpcClient.loadFromProto /transcript-server-js/node_modules/google-gax/src/grpc.ts:165:40)\n    at GrpcClient.loadProto (/transcript-server-js/node_modules/google-gax/src/grpc.ts:199:17)\n    at new SpeechClient /transcript-server-js/lib/webpack:/src/v1/speech_client.ts:135:28)\n    at createText$ (/transcript-server-js/lib/webpack:/src/transcriptGenerator.js:50:18)"
}

Run Code Online (Sandbox Code Playgroud)

这是代码

const { Storage } = require('@google-cloud/storage');
const storage = new Storage();
const results = await storage.getBuckets();
const speech = require('@google-cloud/speech');
const client = new speech.SpeechClient();
Run Code Online (Sandbox Code Playgroud)

谷歌云存储 API 有效。 …

speech-to-text node.js google-cloud-platform

3
推荐指数
1
解决办法
1055
查看次数