evancohen / sonus

:speech_balloon: /so.nus/ STT (speech to text) for Node with offline hotword detection
MIT License
627 stars 79 forks source link

Running on raspberry pi #45

Closed sharmmoh1983 closed 7 years ago

sharmmoh1983 commented 7 years ago

---sonus.js

const Sonus = require('sonus') const speech = require('@google-cloud/speech')({ projectId: 'aimevoice2017', keyFilename: '/home/pi/AimeVoice-91efae41b5b4.json' })

const hotwords = [{ file: 'resources/snowboy.umdl', hotword: 'snowboy' }] const sonus = Sonus.init({ hotwords }, speech) Sonus.start(sonus) sonus.on('hotword', (index, keyword) => console.log("!")) sonus.on('final-result', console.log)

node version v6.10.3

return process.dlopen(module, path._makeLong(filename)); ^

Error: Module version mismatch. Expected 48, got 51.

sharmmoh1983 commented 7 years ago

Also getting error: pi@raspberrypi:~ $ sudo npm install --save sonus

grpc@1.3.7 install /home/pi/node_modules/grpc node-pre-gyp install --fallback-to-build --library=static_library

node-pre-gyp ERR! Tried to download(403): https://storage.googleapis.com/grpc-precompiled-binaries/node/grpc/v1.3.7/node-v48-linux-arm.tar.gz node-pre-gyp ERR! Pre-built binaries not found for grpc@1.3.7 and node@6.9.1 (node-v48 ABI) (falling back to source compile with node-gyp) gyp WARN EACCES user "root" does not have permission to access the dev dir "/root/.node-gyp/6.9.1" gyp WARN EACCES attempting to reinstall using temporary dev dir "/home/pi/node_modules/grpc/.node-gyp" make: Entering directory '/home/pi/node_modules/grpc/build' make: *** No rule to make target '../.node-gyp/6.9.1/include/node/common.gypi', needed by 'Makefile'. Stop. make: Leaving directory '/home/pi/node_modules/grpc/build' gyp ERR! build error gyp ERR! stack Error: make failed with exit code: 2 gyp ERR! stack at ChildProcess.onExit (/opt/nodejs/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:276:23) gyp ERR! stack at emitTwo (events.js:106:13) gyp ERR! stack at ChildProcess.emit (events.js:191:7) gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12) gyp ERR! System Linux 4.4.50-v7+ gyp ERR! command "/opt/nodejs/bin/node" "/opt/nodejs/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--library=static_library" "--module=/home/pi/node_modules/grpc/src/node/extension_binary/grpc_node.node" "--module_name=grpc_node" "--module_path=/home/pi/node_modules/grpc/src/node/extension_binary" gyp ERR! cwd /home/pi/node_modules/grpc gyp ERR! node -v v6.9.1 gyp ERR! node-gyp -v v3.4.0 gyp ERR! not ok node-pre-gyp ERR! build error node-pre-gyp ERR! stack Error: Failed to execute '/opt/nodejs/bin/node /opt/nodejs/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --library=static_library --module=/home/pi/node_modules/grpc/src/node/extension_binary/grpc_node.node --module_name=grpc_node --module_path=/home/pi/node_modules/grpc/src/node/extension_binary' (1) node-pre-gyp ERR! stack at ChildProcess. (/home/pi/node_modules/grpc/node_modules/node-pre-gyp/lib/util/compile.js:83:29) node-pre-gyp ERR! stack at emitTwo (events.js:106:13) node-pre-gyp ERR! stack at ChildProcess.emit (events.js:191:7) node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:877:16) node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5) node-pre-gyp ERR! System Linux 4.4.50-v7+ node-pre-gyp ERR! command "/opt/nodejs/bin/node" "/home/pi/node_modules/grpc/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build" "--library=static_library" node-pre-gyp ERR! cwd /home/pi/node_modules/grpc node-pre-gyp ERR! node -v v6.9.1 node-pre-gyp ERR! node-pre-gyp -v v0.6.34 node-pre-gyp ERR! not ok Failed to execute '/opt/nodejs/bin/node /opt/nodejs/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --library=static_library --module=/home/pi/node_modules/grpc/src/node/extension_binary/grpc_node.node --module_name=grpc_node --module_path=/home/pi/node_modules/grpc/src/node/extension_binary' (1) /home/pi └── (empty)

npm WARN enoent ENOENT: no such file or directory, open '/home/pi/package.json' npm WARN pi No description npm WARN pi No repository field. npm WARN pi No README data npm WARN pi No license field. npm ERR! Linux 4.4.50-v7+ npm ERR! argv "/opt/nodejs/bin/node" "/usr/local/bin/npm" "install" "--save" "sonus" npm ERR! node v6.9.1 npm ERR! npm v3.10.8 npm ERR! code ELIFECYCLE

npm ERR! grpc@1.3.7 install: node-pre-gyp install --fallback-to-build --library=static_library npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the grpc@1.3.7 install script 'node-pre-gyp install --fallback-to-build --library=static_library'. npm ERR! Make sure you have the latest version of node.js and npm installed. npm ERR! If you do, this is most likely a problem with the grpc package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! node-pre-gyp install --fallback-to-build --library=static_library npm ERR! You can get information on how to open an issue for this project with: npm ERR! npm bugs grpc npm ERR! Or if that isn't available, you can get their info via: npm ERR! npm owner ls grpc npm ERR! There is likely additional logging output above.

evancohen commented 7 years ago

First comment Did you downgrade versions of node after installing sonus?

Second comment You shouldn't have to use sudo to install npm libraries. Also, it looks like you are using the --save flag but you haven't initialized npm in your working directory yet, which gives you this part of your error:

npm WARN enoent ENOENT: no such file or directory, open '/home/pi/package.json'

Unfortunetly gRPC doesn't provide precompiled ARM binaries, so they are built on your Pi. That's failing on your device and I'm not totally sure why. Here's what I think you should try:
Make sure you have initialized npm in an empty directory. Don't use sudo when installing. Something like:

mkdir myProject
cd myProject
npm init
npm install sonus --save
sharmmoh1983 commented 7 years ago

Thanks for your reply..I need to know which version of node will work for sonus

On 2 Jun 2017 06:59, "Evan Cohen" notifications@github.com wrote:

First comment Did you downgrade versions of node after installing sonus?

Second comment You shouldn't have to use sudo to install npm libraries. Also, it looks like you are using the --save flag but you haven't initialized npm in your working directory yet, which gives you this part of your error:

npm WARN enoent ENOENT: no such file or directory, open '/home/pi/package.json'

Unfortunetly gRPC doesn't provide precompiled ARM binaries, so they are built on your Pi. That's failing on your device and I'm not totally sure why. Here's what I think you should try: Make sure you have initialized npm in an empty directory. Don't use sudo when installing. Something like:

mkdir myProject cd myProject npm init npm install sonus --save

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/evancohen/sonus/issues/45#issuecomment-305643683, or mute the thread https://github.com/notifications/unsubscribe-auth/AIGdhFFfP6syZOajDWavX6CiUGMWahgsks5r_0I-gaJpZM4Ns9cB .

evancohen commented 7 years ago

Node 4.0+ should work just fine, but if you change the version after installing Node won't be able to find the correct binary version.

Also, if you still have permissions issues with building grpc you can use the --unsafe-perm flag when installing to see if that helps

sharmmoh1983 commented 7 years ago

Hi

Please assist me in getting this through I am getting again errors on windows:

node version 6.9.2

I tried all your options . Can you please tell me what is going wrong

npm install sonus --save --unsafe-perm

node-pre-gyp ERR! Tried to download(403): https://snowboy-release-node.s3-us-wes t-2.amazonaws.com/snowboy/v1.2.0/Release/snowboy-v1.2.0-node-v48-win32-x64.tar.g z node-pre-gyp ERR! Pre-built binaries not found for snowboy@1.2.0 and node@6.9.2 (node-v48 ABI) (falling back to source compile with node-gyp)

C:\Sonusproject\node_modules\snowboy>if not defined npm_config_node_gyp (node "C :\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\....\node_modules\nod e-gyp\bin\node-gyp.js" clean ) else (node "" clean )

C:\Sonusproject\node_modules\snowboy>if not defined npm_config_node_gyp (node "C :\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\....\node_modules\nod e-gyp\bin\node-gyp.js" configure --fallback-to-build --module=C:\Sonusproject\no de_modules\snowboy\lib\node\binding\Release\node-v48-win32-x64\snowboy.node --mo dule_name=snowboy --module_path=C:\Sonusproject\node_modules\snowboy\lib\node\bi nding\Release\node-v48-win32-x64 ) else (node "" configure --fallback-to-build --module=C:\Sonusproject\node_modules\snowboy\lib\node\binding\Release\node-v48- win32-x64\snowboy.node --module_name=snowboy --modulepath=C:\Sonusproject\node modules\snowboy\lib\node\binding\Release\node-v48-win32-x64 ) 'pwd' is not recognized as an internal or external command, operable program or batch file. gyp: Call to 'pwd' returned exit status 1 while in binding.gyp. while trying to load binding.gyp gyp ERR! configure error gyp ERR! stack Error: gyp failed with exit code: 1 gyp ERR! stack at ChildProcess.onCpExit (C:\Program Files\nodejs\node_module s\npm\node_modules\node-gyp\lib\configure.js:305:16) gyp ERR! stack at emitTwo (events.js:106:13) gyp ERR! stack at ChildProcess.emit (events.js:191:7) gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_proces s.js:215:12) gyp ERR! System Windows_NT 6.1.7601 gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodej s\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "configure" "--f allback-to-build" "--module=C:\Sonusproject\node_modules\snowboy\lib\node\ binding\Release\node-v48-win32-x64\snowboy.node" "--module_name=snowboy" "--m odule_path=C:\Sonusproject\node_modules\snowboy\lib\node\binding\Release\ \node-v48-win32-x64" gyp ERR! cwd C:\Sonusproject\node_modules\snowboy gyp ERR! node -v v6.9.2 gyp ERR! node-gyp -v v3.4.0 gyp ERR! not ok node-pre-gyp ERR! build error node-pre-gyp ERR! stack Error: Failed to execute 'node-gyp.cmd configure --fallb ack-to-build --module=C:\Sonusproject\node_modules\snowboy\lib\node\binding\Rele ase\node-v48-win32-x64\snowboy.node --module_name=snowboy --module_path=C:\Sonus project\node_modules\snowboy\lib\node\binding\Release\node-v48-win32-x64' (1) node-pre-gyp ERR! stack at ChildProcess. (C:\Sonusproject\node_mo dules\snowboy\node_modules\node-pre-gyp\lib\util\compile.js:83:29) node-pre-gyp ERR! stack at emitTwo (events.js:106:13) node-pre-gyp ERR! stack at ChildProcess.emit (events.js:191:7) node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:877:16) node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/chi ld_process.js:226:5) node-pre-gyp ERR! System Windows_NT 6.1.7601 node-pre-gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Sonusprojec t\node_modules\snowboy\node_modules\node-pre-gyp\bin\node-pre-gyp" "instal l" "--fallback-to-build" node-pre-gyp ERR! cwd C:\Sonusproject\node_modules\snowboy node-pre-gyp ERR! node -v v6.9.2 node-pre-gyp ERR! node-pre-gyp -v v0.6.36 node-pre-gyp ERR! not ok Failed to execute 'node-gyp.cmd configure --fallback-to-build --module=C:\Sonusp roject\node_modules\snowboy\lib\node\binding\Release\node-v48-win32-x64\snowboy. node --module_name=snowboy --module_path=C:\Sonusproject\node_modules\snowboy\li b\node\binding\Release\node-v48-win32-x64' (1) npm WARN sonusproject@1.0.0 No description npm WARN sonusproject@1.0.0 No repository field. npm ERR! Windows_NT 6.1.7601 npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\ node_modules\npm\bin\npm-cli.js" "install" "sonus" "--save" "--unsafe-perm" npm ERR! node v6.9.2 npm ERR! npm v3.10.9 npm ERR! code ELIFECYCLE

npm ERR! snowboy@1.2.0 install: node-pre-gyp install --fallback-to-build npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the snowboy@1.2.0 install script 'node-pre-gyp install --fall back-to-build'. npm ERR! Make sure you have the latest version of node.js and npm installed. npm ERR! If you do, this is most likely a problem with the snowboy package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! node-pre-gyp install --fallback-to-build npm ERR! You can get information on how to open an issue for this project with: npm ERR! npm bugs snowboy npm ERR! Or if that isn't available, you can get their info via: npm ERR! npm owner ls snowboy npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request: npm ERR! C:\Sonusproject\node_modules\npm-debug.log

On Fri, Jun 2, 2017 at 8:37 AM, Evan Cohen notifications@github.com wrote:

Node 4.0+ should work just fine, but if you change the version after installing Node won't be able to find the correct binary version.

Also, if you still have permissions issues with building grpc you can use the --unsafe-perm flag when installing to see if that helps

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/evancohen/sonus/issues/45#issuecomment-305657592, or mute the thread https://github.com/notifications/unsubscribe-auth/AIGdhHmA66wl8IpLmri9oToCSSiZpsWQks5r_1kygaJpZM4Ns9cB .

evancohen commented 7 years ago

As stated in the README, Windows is an unsupported platform.

sharmmoh1983 commented 7 years ago

But I am getting the same error gyp as on raspberry pi

Can i set up a call today some time to get this sorted as I really need this to be running

Highly appreciate if you are available

On Fri, Jun 2, 2017 at 9:30 AM, Evan Cohen notifications@github.com wrote:

As stated in the README, Windows is an unsupported platform.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/evancohen/sonus/issues/45#issuecomment-305664653, or mute the thread https://github.com/notifications/unsubscribe-auth/AIGdhID7lbXHw-x_wKmIL14q6gmQXlxyks5r_2WrgaJpZM4Ns9cB .

sharmmoh1983 commented 7 years ago

Thanks for your assistance . Issue is resolved now

sharmmoh1983 commented 7 years ago

Can you tell me how to send data to google speech api

evancohen commented 7 years ago

@sharmmoh1983 it might be helpful if you described your solution for anyone else who runs into this issue. Sonus handles sending to the cloud speech recognizer automatically, all you have to do is pipe your audio to the initialized Sonus object. After that, if you want to manually trigger streaming you can use trigger as described in the documentation: https://github.com/evancohen/sonus/blob/master/docs/API.md#trigger-keywordhotword-manually

sharmmoh1983 commented 7 years ago

It was just the internet issue on raspberry pi which was not downloading the packages in required fashion Once that got resolved build happened successfully