Skip to content
This repository was archived by the owner on Jun 19, 2025. It is now read-only.
This repository was archived by the owner on Jun 19, 2025. It is now read-only.

nodejs package deepspeech crashes (using node v16.0.0) #3642

Closed
@solyarisoftware

Description

@solyarisoftware

My program: deepSpeechTranscriptNative.js, part of a simple project DeepSpeechJs I made to use/test DeepSpeech nodejs bindings APIs, crashes when using latest nodejs version.
Below all details.

My configuration:

(deepspeech-venv) $ inxi -S
System:    Host: giorgio-HP-Laptop-17-by1xxx Kernel: 5.8.0-50-generic x86_64 bits: 64 Desktop: Gnome 3.36.7 
           Distro: Ubuntu 20.04.2 LTS (Focal Fossa) 

(deepspeech-venv) $ deepspeech --version
DeepSpeech  0.9.3

deepspeech-venv) $ npm info deepspeech

deepspeech@0.9.3 | MPL-2.0 | deps: 5 | versions: 97
DeepSpeech NodeJS bindings
https://github.com/mozilla/DeepSpeech/tree/v0.9.3#project-deepspeech

bin: deepspeech

dist
.tarball: https://registry.npmjs.org/deepspeech/-/deepspeech-0.9.3.tgz
.shasum: 675917addc2e2a16fb2bc03718d6a4e6b1bbf650
.integrity: sha512-80yqUWEWgzclY9pjukpq0TdkQEbJ6NzqZ899vsLZfa4YcK35uOWIf+ILK55zQ+Ii/TEJ6Eo62Vc2saedQ/AK6w==
.unpackedSize: 120.3 MB

dependencies:
argparse: 1.0.x      memory-stream: 1.0.x node-pre-gyp: 0.15.x node-wav: 0.0.2      sox-stream: 2.0.x    

maintainers:
- deepspeech-ci <npmjs@deep-speech.org>
- reubenmorais <reuben.morais@gmail.com>
- mozilla-voice-owner <mozilla-voice-package-owner@mozilla.com>

dist-tags:
latest: 0.9.3               prerelease: 0.10.0-alpha.3  

(deepspeech-venv) $ node --version
v16.0.0

CRASH HAPPENS WHEN USING NODEJS V.16

(deepspeech-venv) $ node deepSpeechTranscriptNative.js 
node:internal/modules/cjs/loader:943
  throw err;
  ^

Error: Cannot find module '/home/giorgio/DeepSpeechJs/node_modules/deepspeech/lib/binding/v0.9.3/linux-x64/node-v93/deepspeech.node'
Require stack:
- /home/giorgio/DeepSpeechJs/node_modules/deepspeech/index.js
- /home/giorgio/DeepSpeechJs/deepSpeechTranscriptNative.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:940:15)
    at Function.Module._load (node:internal/modules/cjs/loader:773:27)
    at Module.require (node:internal/modules/cjs/loader:1012:19)
    at require (node:internal/modules/cjs/helpers:93:18)
    at Object.<anonymous> (/home/giorgio/DeepSpeechJs/node_modules/deepspeech/index.js:24:17)
    at Module._compile (node:internal/modules/cjs/loader:1108:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1137:10)
    at Module.load (node:internal/modules/cjs/loader:988:32)
    at Function.Module._load (node:internal/modules/cjs/loader:828:14)
    at Module.require (node:internal/modules/cjs/loader:1012:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/home/giorgio/DeepSpeechJs/node_modules/deepspeech/index.js',
    '/home/giorgio/DeepSpeechJs/deepSpeechTranscriptNative.js'
  ]
}

NO PROBLEMS WHEN USING NODEJS V.14.16.1

(deepspeech-venv) $ sudo n install 14.16.1
  installing : node-v14.16.1
       mkdir : /usr/local/n/versions/node/14.16.1
       fetch : https://nodejs.org/dist/v14.16.1/node-v14.16.1-linux-x64.tar.xz
   installed : v14.16.1 (with npm 6.14.12)
(deepspeech-venv) $ node --version
v14.16.1

(deepspeech-venv) $ node deepSpeechTranscriptNative.js 

usage: node deepSpeechTranscriptNative [<model pbmm file>] [<model scorer file>] [<audio file>]
using: node deepSpeechTranscriptNative ./models/deepspeech-0.9.3-models.pbmm ./models/deepspeech-0.9.3-models.scorer ./audio/4507-16021-0012.wav

TensorFlow: v2.3.0-6-g23ad988
DeepSpeech: v0.9.3-0-gf2e9c85
2021-05-03 11:32:41.310018: I tensorflow/core/platform/cpu_feature_guard.cc:142] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN)to use the following CPU instructions in performance-critical operations:  AVX2 FMA
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.

pbmm                 : ./models/deepspeech-0.9.3-models.pbmm
scorer               : ./models/deepspeech-0.9.3-models.scorer
elapsed              : 10ms

audio file           : ./audio/4507-16021-0012.wav
transcript           : why should one halt on the way
elapsed              : 3131ms

free model elapsed   : 24ms

Notes:

  • it seems to me that the issue is related to NodeJs version 16.0 and previouses?).

  • I see that some updates has been done recently in the DeepSpeech project: https://github.com/mozilla/DeepSpeech/tree/master/native_client/javascript

  • I have the same issue if I install deepspech package 0.10.0-alpha.3 instead of 0.9.3

  • Maybe is the problem related to the deepspeech npm package (last update is 5 months ago) that has to be republished to include updates?

Thanks
Giorgio

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions