alphacep / vosk-api

Offline speech recognition API for Android, iOS, Raspberry Pi and servers with Python, Java, C# and Node
Apache License 2.0
7.38k stars 1.04k forks source link

[WIN] [ERR] Can't install vosk on Nodejs, Windows 11 #1227

Open affanmehmood opened 1 year ago

affanmehmood commented 1 year ago

Is it possible to run this project on a windows machine?

My Node version is 14.19.0 My python version is 3.7.9

Is it possible to run it in windows in a node environment? Can someone guide me on how to do that?

when I npm install I get the following error:

C:\User\vosk-api\nodejs>npm i

ffi-napi@4.0.3 install C:\User\vosk-api\nodejs\node_modules\ffi-napi node-gyp-build C:\User\vosk-api\nodejs\node_modules\ffi-napi>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\....\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild ) Building the projects in this solution one at a time. To enable parallel build, please add the "-m" switch. Preprocessing assembly file ......\deps\libffi\src\x86\win64_intel.preasm Programc1 : fatal error C1083: Cannot open source file: 'C:\Program': No such file or directory [C:\User\vosk-api\no dejs\node_modules\ffi-napi\build\deps\libffi\ffi.vcxproj] Files c1 : fatal error C1083: Cannot open source file: 'Files': No such file or directory [C:\User\vosk-api\nodejs\ node_modules\ffi-napi\build\deps\libffi\ffi.vcxproj] Microsoft c1 : fatal error C1083: Cannot open source file: '(x86)\Microsoft': No such file or directory [C:\User\vosk-a pi\nodejs\node_modules\ffi-napi\build\deps\libffi\ffi.vcxproj] Visual c1 : fatal error C1083: Cannot open source file: 'Visual': No such file or directory [C:\User\vosk-api\nodejs \node_modules\ffi-napi\build\deps\libffi\ffi.vcxproj] BuildTools c1 : fatal error C1083: Cannot open source file: 'Studio\2019\BuildTools': No such file or directory [C:\User \vosk-api\nodejs\node_modules\ffi-napi\build\deps\libffi\ffi.vcxproj] win64_intel.preasm C:\User\vosk-api\nodejs\node_modules\ffi-napi\build\deps\libffi\ffi.targets(34,5): error MSB3721: The command "call call "......\deps\libffi\preprocess_asm.cmd" "......\deps\libffi\include" "......\deps\libffi\config\win\x 64" "......\deps\libffi\src\x86\win64_intel.preasm" "Release\obj\ffi\win64_intel.asm"" exited with code 2. [C:\Work\a ffect-cx\vosk-api\nodejs\node_modules\ffi-napi\build\deps\libffi\ffi.vcxproj] Program Files Microsoft Visual BuildTools nothing.c c1 : fatal error C1083: Cannot open source file: '(x86)\Microsoft': No such file or directory [C:\User\vosk-a pi\nodejs\node_modules\ffi-napi\node-addon-api\nothing.vcxproj] c1 : fatal error C1083: Cannot open source file: 'Studio\2019\BuildTools': No such file or directory [C:\User \vosk-api\nodejs\node_modules\ffi-napi\node-addon-api\nothing.vcxproj] c1 : fatal error C1083: Cannot open source file: 'Visual': No such file or directory [C:\User\vosk-api\nodejs \node_modules\ffi-napi\node-addon-api\nothing.vcxproj] c1 : fatal error C1083: Cannot open source file: 'Files': No such file or directory [C:\User\vosk-api\nodejs\ node_modules\ffi-napi\node-addon-api\nothing.vcxproj] c1 : fatal error C1083: Cannot open source file: 'C:\Program': No such file or directory [C:\User\vosk-api\no dejs\node_modules\ffi-napi\node-addon-api\nothing.vcxproj] gyp ERR! build error gyp ERR! stack Error: C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\MSBuild.exe failed with exit code: 1 gyp ERR! stack at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:194:23) gyp ERR! stack at ChildProcess.emit (events.js:400:28) gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:282:12) gyp ERR! System Windows_NT 10.0.22000 gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\ProgramFiles\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild" gyp ERR! cwd C:\User\vosk-api\nodejs\node_modules\ffi-napi gyp ERR! node -v v14.19.0 gyp ERR! node-gyp -v v5.1.0 gyp ERR! not ok npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! ffi-napi@4.0.3 install: node-gyp-build npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the ffi-napi@4.0.3 install script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above. npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\name\AppData\Roaming\npm-cache_logs\2022-12-16T06_02_20_451Z-debug.log

nshmyrev commented 1 year ago

Please click on "Post Edit" and format your code properly

affanmehmood commented 1 year ago

@nshmyrev sorry about that. I've formatted it now.

nshmyrev commented 1 year ago

It is some recent bug in ff-napi it seems, it doesn't like spaces in your path

nshmyrev commented 1 year ago

As a quick fix you can install node into root folder instead of 'program files'

nshmyrev commented 1 year ago

Or you have "Program Files" somewhere in environment variable that affects node

affanmehmood commented 1 year ago

I'm getting the same error after installing node inside the root

C:\User\vosk-api>npm install

ffi-napi@4.0.3 install C:\User\vosk-api\node_modules\ffi-napi node-gyp-build C:\User\vosk-api\node_modules\ffi-napi>if not defined npm_config_node_gyp (node "C:\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\....\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "C:\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild ) Building the projects in this solution one at a time. To enable parallel build, please add the "-m" switch. Preprocessing assembly file ......\deps\libffi\src\x86\win64_intel.preasm Program c1 : fatal error C1083: Cannot open source file: 'C:\Program': No such file or directory [C:\User\vosk-api\no de_modules\ffi-napi\build\deps\libffi\ffi.vcxproj] Files c1 : fatal error C1083: Cannot open source file: 'Files': No such file or directory [C:\User\vosk-api\node_mo dules\ffi-napi\build\deps\libffi\ffi.vcxproj] Microsoft c1 : fatal error C1083: Cannot open source file: '(x86)\Microsoft': No such file or directory [C:\User\vosk-a pi\node_modules\ffi-napi\build\deps\libffi\ffi.vcxproj] Visual c1 : fatal error C1083: Cannot open source file: 'Visual': No such file or directory [C:\User\vosk-api\node_m odules\ffi-napi\build\deps\libffi\ffi.vcxproj] BuildTools c1 : fatal error C1083: Cannot open source file: 'Studio\2019\BuildTools': No such file or directory [C:\User \vosk-api\node_modules\ffi-napi\build\deps\libffi\ffi.vcxproj] win64_intel.preasm C:\User\vosk-api\node_modules\ffi-napi\build\deps\libffi\ffi.targets(34,5): error MSB3721: The command "call call "......\deps\libffi\preprocess_asm.cmd" "......\deps\libffi\include" "......\deps\libffi\config\win\x64" ".. ....\deps\libffi\src\x86\win64_intel.preasm" "Release\obj\ffi\win64_intel.asm"" exited with code 2. [C:\Work\affect-c x\vosk-api\node_modules\ffi-napi\build\deps\libffi\ffi.vcxproj] Program Files Microsoft Visual BuildTools nothing.c c1 : fatal error C1083: Cannot open source file: '(x86)\Microsoft': No such file or directory [C:\User\vosk-a pi\node_modules\ffi-napi\node-addon-api\nothing.vcxproj] c1 : fatal error C1083: Cannot open source file: 'Files': No such file or directory [C:\User\vosk-api\node_mo dules\ffi-napi\node-addon-api\nothing.vcxproj] c1 : fatal error C1083: Cannot open source file: 'Visual': No such file or directory [C:\User\vosk-api\node_m odules\ffi-napi\node-addon-api\nothing.vcxproj] c1 : fatal error C1083: Cannot open source file: 'Studio\2019\BuildTools': No such file or directory [C:\User \vosk-api\node_modules\ffi-napi\node-addon-api\nothing.vcxproj] c1 : fatal error C1083: Cannot open source file: 'C:\Program': No such file or directory [C:\User\vosk-api\no de_modules\ffi-napi\node-addon-api\nothing.vcxproj] gyp ERR! build error gyp ERR! stack Error: C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\MSBuild.exe failed with exit code: 1 gyp ERR! stack at ChildProcess.onExit (C:\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:194:23) gyp ERR! stack at ChildProcess.emit (events.js:315:20) gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12) gyp ERR! System Windows_NT 10.0.22000 gyp ERR! command "C:\nodejs\node.exe" "C:\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild" gyp ERR! cwd C:\User\vosk-api\node_modules\ffi-napi gyp ERR! node -v v14.16.0 gyp ERR! node-gyp -v v5.1.0 gyp ERR! not ok npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! ffi-napi@4.0.3 install: node-gyp-build npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the ffi-napi@4.0.3 install script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above. npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\affan\AppData\Roaming\npm-cache_logs\2022-12-16T12_51_45_462Z-debug.log

tansyxiao commented 7 months ago

I'm having the same issue, the problem is also ffi-napi. Trying to run a program that works on Mac on a Windows machine. Has anyone solved this?

pranav-inaira commented 3 weeks ago

Its still broken, not working in windows 11, Node Version 20

weskerty commented 3 days ago

Same Debian 12