谷歌语音无法find模块

我试图将插入Tessel2微控制器的麦克风输出到@ google-cloud / speech API。

我正在使用Windows 8操作系统。

我不断收到这个错误:

module.js:471 throw err; ^ Error: Cannot find module '/tmp/remote-script/node_modules/@google-cloud/speech/node_modules/grpc/src/node/extension_binary/node-v48-linux-mipsel/grpc_node.node' at Function.Module._resolveFilename (module.js:469:15) at Function.Module._load (module.js:417:25) at Module.require (module.js:497:17) at require (internal/module.js:20:19) at Object.<anonymous> (/tmp/remote-script/node_modules/@google-cloud/speech/node_modules/grpc/src/node/src/grpc_extension.js:1:205) at Module._compile (module.js:570:32) at Object.Module._extensions..js (module.js:579:10) at Module.load (module.js:487:32) at tryModuleLoad (module.js:446:12) at Function.Module._load (module.js:438:3) 

它正在寻找一个Linux文件夹,但是当我查看这个path时,我有一个名为“node-v48-win32-ia32”的文件夹。

有没有人有任何build议来解决这个问题?

我得到这个错误,即使我只是需要的API:

 const google_speech = require('@google-cloud/speech')({ projectId: "voice-controlled-translator", keyFilename: __dirname + "/voice-controlled translator-1daea28cb9c9.json" }); 

愚蠢的问题,你最近运行npm i吗?

编辑1:啊,操作系统的差异。 从目标操作系统运行npm i可能会修复它,如果你可以这样做。

编辑2:做了一些更多的挖掘,似乎gRPC不提供预build的二进制文件为您的目标架构。 我运行npm i grpc --target_platform="linux" --target_arch="mipsel" ,试图下载所说的预编译的二进制代码。 它确实试图创build这个二进制文件,但不pipe这个文件是否能工作,都超出了我的testing能力,因为我没有这样的设备。 绝对尝试它,并报告回来。

grpc-node似乎在这里列出了一个纯JS实现: https : //github.com/grpc/grpc-node你可以尝试使用它。 npm i @grpc/js-core你可能需要对@google-cloud/speech进行一些调整。