Google-Cloud TTS import error: ''error reading first path in the walk C:\Users\…\Documents\protos"

跟風遠走 提交于 2020-01-06 05:51:13

问题


I'm currently building an Electron app using @google-cloud/text-to-speech npm module. If I import the module, everything is fine. However, once I call it I get the following error:

Uncaught Error: error reading first path in the walk C:\Users\...\Documents\protos
Error: ENOENT: no such file or directory, lstat 'C:\Users\...\Documents\protos'
    at EventEmitter.eval (webpack:///./node_modules/walkdir/walkdir.js?:265)
    at Object.onceWrapper (events.js:282)
    at EventEmitter.emit (events.js:194)
    at fn (webpack:///./node_modules/walkdir/walkdir.js?:100)
    at statter (webpack:///./node_modules/walkdir/walkdir.js?:137)
    at walkdir (webpack:///./node_modules/walkdir/walkdir.js?:269)
    at Function.walkdir.sync (webpack:///./node_modules/walkdir/walkdir.js?:15)
    at eval (webpack:///./node_modules/google-gax/build/src/grpc.js?:50)
    at Object../node_modules/google-gax/build/src/grpc.js (renderer.bundle.js:7235)
    at __webpack_require__ (renderer.bundle.js:20)

Other important modules I am using are Webpack, React, and TypeScript

Here is the code I use to import it:

import * as textToSpeech from '@google-cloud/text-to-speech';
import * as fs from 'fs';
import * as util from 'util';

export default class TTSClient {
  constructor(projectId: string, keyFilename: string) {
    const client = new textToSpeech.TextToSpeechClient({projectId, keyFilename});
}

I use the following declaration to convert from JS: declare module '@google-cloud/text-to-speech';

The root of the project is located at C:\Users\...\Documents\TTS-Reader\src

来源:https://stackoverflow.com/questions/56885985/google-cloud-tts-import-error-error-reading-first-path-in-the-walk-c-users

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!