node.js - 如何解决 Google Speech-To-Text Error 的错误?
问题描述
我已经设置了 package.json 文件。
"scripts": {
"start": "set GOOGLE_APPLICATION_CREDENTIALS=/My Path/my.json && node app.js"
},
但是,我有这样的错误,
(node:28590) UnhandledPromiseRejectionWarning: Error: 7 PERMISSION_DENIED: Your application has authenticated using end user credentials from the Google Cloud SDK or Google Cloud Shell which are not supported by the speech.googleapis.com. We recommend configuring the billing/quota_project setting in gcloud or using a service account through the auth/impersonate_service_account setting. For more information about service accounts and how to use them in your application, see https://cloud.google.com/docs/authentication/. If you are getting this error with curl or similar tools, you may need to specify 'X-Goog-User-Project' HTTP header for quota and billing purposes. For more information regarding 'X-Goog-User-Project' header, please check https://cloud.google.com/apis/docs/system-parameters.
at Object.callErrorFromStatus (/Users/bruce/Workspace/amosense/node_modules/@grpc/grpc-js/build/src/call.js:31:26)
at Object.onReceiveStatus (/Users/bruce/Workspace/amosense/node_modules/@grpc/grpc-js/build/src/client.js:179:52)
at Object.onReceiveStatus (/Users/bruce/Workspace/amosense/node_modules/@grpc/grpc-js/build/src/client-interceptors.js:336:141)
at Object.onReceiveStatus (/Users/bruce/Workspace/amosense/node_modules/@grpc/grpc-js/build/src/client-interceptors.js:299:181)
at /Users/bruce/Workspace/amosense/node_modules/@grpc/grpc-js/build/src/call-stream.js:145:78
at processTicksAndRejections (internal/process/task_queues.js:77:11)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:28590) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:28590) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
我已经尝试按照以下指南进行操作,但仍然遇到与上述相同的错误。 类似问题
奇怪的是,它在服务器上运行良好,但在 localhost 上不断出现错误。我希望有人可以指导我。
谢谢。
解决方案
推荐阅读
- c# - html 路由值未传递到 url/控制器
- r - 将数据类型因子转换为数据类型数值
- latex - 使用 LaTeX 文本渲染将 matplotlib 的 pdf 输出增加了 20 倍。有没有办法避免文件大小的增加?
- docker - 连续重试下载后 Docker pull 失败
- python - ubuntu wsl 上的 postgres 在 ::1 上运行,而不是在 localhost/127.0.0.1 上运行
- javascript - 使用等待时返回空?
- xml - XSLT 按条件对标记化的值进行分组
- algorithm - 无法创建具有正确结构的树
- javascript - 在这种情况下,find 和 findOne 有什么区别?为什么它不起作用?
- linux - 在 Travis-CI 中采购 .bashrc 不起作用