0

I need to get GoogleSTT installed on a machine, but the code doesn't work, it works when i'm on my computer but not on my Buildroot system.

i got this error at runtime:

    /root/node_modules/grpc/src/grpc_extension.js:57
        throw e;
        ^

    Error: File not found
        at Object.Module._extensions..node (module.js:681:18)
        at Module.load (module.js:565:32)
        at tryModuleLoad (module.js:505:12)
        at Function.Module._load (module.js:497:3)
        at Module.require (module.js:596:17)
        at require (internal/module.js:11:18)
        at Object.<anonymous>                                                                         
    (/root/node_modules/grpc/src/grpc_extension.js:32:13)
        at Module._compile (module.js:652:30)
        at Object.Module._extensions..js (module.js:663:10)
        at Module.load (module.js:565:32)

I'm probably missing a package but all mentionned above are correctly installed, the code was tested on my computer with no error at all,

i tried cleaning cache, rebuild modules with -f

const io = require("socket.io-client");
const record = require('node-record-lpcm16');
const speech = require('@google-cloud/speech');


const client = new speech.SpeechClient();
var socket = io.connect("http://90.87.53.32:7700/");

const encoding = 'LINEAR16';
const sampleRateHertz = 16000;
const languageCode = 'fr-FR';

const request = {
    config: {
        encoding: encoding,
        sampleRateHertz: sampleRateHertz,
        languageCode: languageCode,
        enableAutomaticPunctuation: true,
    },
    interimResults: true, // If you want interim results, set this to true
};


/*class Socket {
    constructor() {
        process.on('message', (msg) => {
            this.set(msg);
        });
        process.send('loaded');
    }
}*/

const recognizeStream = client
    .streamingRecognize(request)
    .on('error', console.error)
    .on('data', data =>
        socket.emit("lol", (
            data.results[0] && data.results[0].alternatives[0]
                ? `Transcription: ${data.results[0].alternatives[0].transcript}\n`
                : `\n\nReached transcription time limit, press Ctrl+C\n`))
    );

socket.on('connect', function () {
    record
        .start({
            sampleRateHertz: sampleRateHertz,
            threshold: 0,
            verbose: false,
            recordProgram: 'arecord', // Try also "arecord" or "sox"
            silence: '10.0',
        })
        .on('error', console.error)
        .pipe(recognizeStream);

    console.log('Listening, press Ctrl+C to stop.');
    socket.emit('lol', "Message");
});

the same error occure with or w/o socket.io-client.

as my BIOS doesn't have a RTC, i have some hardcoded time update method so google may not be able to get correct date & time on my machine but i think it crashes even before executing anything

Here more infos:

npm

process.versions

{ http_parser: '2.8.1',
  node: '8.11.4',
  v8: '6.2.414.54',
  uv: '1.20.2',
  zlib: '1.2.11',
  ares: '1.14.0',
  modules: '57',
  nghttp2: '1.32.0',
  napi: '3',
  openssl: '1.0.2p' }

os.platform()

'linux'

os.arch()

'arm64'

_

Syst

uname -a

Linux buildroot 4.14.29-v8 #1 SMP PREEMPT Mon Apr 29 13:48:27 UTC 2019 aarch64 GNU/Linux the date is broken here due to lack of rtc as i said, to communicate with node servers i have to manually set correct date & time

npm ls grpc

/root -- @google-cloud/speech@2.3.1 -- google-gax@0.25.6 +-- grpc@1.20.2 -- grpc-gcp@0.1.1 -- grpc@1.20.2 deduped

ls -lR node_modules/grpc/src/node

node_modules/grpc/src/node:
    total 1
    drwxr-xr-x    3 root     root          1024 Apr 30  2019 extension_binary

 node_modules/grpc/src/node/extension_binary:
    total 1
    drwxr-xr-x    2 root     root          1024 Apr 30  2019 node-v57-linux-                    
    arm64-glibc

 node_modules/grpc/src/node/extension_binary/node-v57-linux-arm64-glibc:
    total 13983
    -rwxr-xr-x    1 root     root      14318016 Apr 26  2019 grpc_node.node

plus: how i update machine's clock

date -s "$(wget -qSO- google.com 2>&1 | grep Date: | cut -d' ' -f5-8 | awk -v FS=' ' -v OFS=- '{print $3,$2,$1,$4}' | sed -r 's/\bJan\b/01/g; s/\bFeb\b/02/g; s/\bMar\b/03/g; s/\bApr\b/04/g; s/\bMay\b/05/g; s/\bJun\b/06/g; s/\bJul\b/07/g; s/\bAug\b/08/g; s/\bSep\b/09/g; s/\bOct\b/10/g; s/\bNov\b/11/g; s/\bDec\b/12/g' | sed 's/./ /11')"

Fixing in progress

Actions done:

Modifying l:32 of /root/node_modules/grpc/src/grpc_extension.js

binary.find(path.resolve(path.join(__dirname, '../package.json')));

The corresponding path is /root/node_modules/grpc/src/node/extension_binary/node-v57-linux-arm64-glibc/grpc_node.node which is the correct binary path

trying to ignore this will lead me to lack of functions from gRPC and enable to use it:

/root/node_modules/grpc/src/client_interceptors.js:664
  [grpc.opType.SEND_MESSAGE]: [grpc.opType.SEND_INITIAL_METADATA],
               ^
 TypeError: Cannot read property 'SEND_MESSAGE' of undefined
    at Object.<anonymous> 
    (/root/node_modules/grpc/src/client_interceptors.js:664:16)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/root/node_modules/grpc/src/client.js:35:27)
    at Module._compile (module.js:652:30)
  • A few pieces of information would help diagnose this: the version of grpc (from `npm ls grpc`), the contents of `node_modules/grpc/src/node`, and the output of `uname -a` (you can omit the hostname, that's not relevant here). – murgatroid99 May 01 '19 at 18:10
  • i've added the infos you asked thanks – Ed Ouard Chichombah700 May 02 '19 at 08:43
  • First, that npm "certificate not yet valid" error looks like a clock problem. It must have worked at one point, because that's the only way you could have gotten that `grpc_node.node` file in the first place. Second, there is some more information that could help here: when running `node`, the output of `process.versions`, `os.platform()` and `os.arch()`. I'm trying to figure out why there is a "File not found" error, and based on the information you provided it should be looking for the file that is actually there. – murgatroid99 May 02 '19 at 16:37
  • yeah, the "certificate error" occur often but i can fix it manually with the date comment. – Ed Ouard Chichombah700 May 02 '19 at 17:13
  • OK, I have one more troubleshooting idea: about half-way down the original error stack you can see that the error is coming from `node_modules/grpc/src/grpc_extension.js` line 32. Try modifying that file directly and adding a line right before that one that prints the file path it's trying to require. – murgatroid99 May 02 '19 at 17:47
  • i've console logged it, and nothing seems to be wrong, but the i've console log the require of this binary and same error, i don't know why it can't load it (maybe the arch) ? – Ed Ouard Chichombah700 May 03 '19 at 07:51
  • Sorry, this has me stumped. I have no idea why a configuration like you have would result in that error. – murgatroid99 May 04 '19 at 00:11
  • Sad, is their zero chance for me to have it manually fixed ? If yes how ? Otherwise thanks a lot for all the support, I'll try other services despite my willing to implement google in my product – Ed Ouard Chichombah700 May 04 '19 at 11:02
  • I'm sorry. I don't have anything to suggest because I don't know what is going wrong. – murgatroid99 May 06 '19 at 20:51
  • is their any chance i could try to change my machine's architecture, software or something to 'copy' how it have been implemented in the Google embedded device ? – Ed Ouard Chichombah700 May 07 '19 at 09:45

0 Answers0