【发布时间】:2020-06-20 16:04:58
【问题描述】:
我正在尝试使用 NodeJs Text To Speech Client Libary 在电子中运行 Google Text-To-Speech
我可以在我的项目的main.js 中使用require('@google-cloud/text-to-speech');(创建浏览器窗口)`,但不能在页面内的脚本中运行它。
我得到的错误如下:
Uncaught TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type object
at validateString (internal/validators.js:112:11)
at Object.basename (path.js:671:5)
at GrpcClient.loadProto (path\to\project\node_modules\google-gax\build\src\grpc.js:117:29)
at new TextToSpeechClient (path\to\project\node_modules\@google-cloud\text-to-speech\build\src\v1\text_to_speech_client.js:106:32)
at file://path/to/project/scripts/speech/ttscli.js:7:16
来自位于scripts/speech/ttscli.js的code
nodeIntegration 设置为 true,scripts/speech/ttscli.js 的使用方式如下:
<script src="./scripts/speech/ttscli.js"></script>
任何帮助将不胜感激
【问题讨论】:
标签: node.js electron google-text-to-speech