NodeJS node-gyp configure errors and not being able to install ffi-napi

Viewed 808

I have a callerID device, so I have to work with its' dll. I installed ffi-napi before and tested it on Windows DLLs(user32). It worked then but for the device's dll, I had to make node 32 bit because the dll is 32 bit also. Then all the problems started. I searched and I saw I have to install node-gyp first and then the ffi-napi package. The code below shows the error I get when I try to install ffi-napi without node-gyp configuration. I have downloaded Visual Studio and its components for node-gyp.

gyp ERR! find VS
gyp ERR! find VS msvs_version was set from command line or npm config
gyp ERR! find VS - looking for Visual Studio version 2017
gyp ERR! find VS VCINSTALLDIR not set, not running in VS Command Prompt
gyp ERR! find VS checking VS2019 (16.11.31727.386) found at:
gyp ERR! find VS "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community"
gyp ERR! find VS - found "Visual Studio C++ core features"
gyp ERR! find VS - found VC++ toolset: v142
gyp ERR! find VS - found Windows SDK: 10.0.19041.0
gyp ERR! find VS - msvs_version does not match this version
gyp ERR! find VS checking VS2017 (15.9.28307.1684) found at:
gyp ERR! find VS "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools"
gyp ERR! find VS - found "Visual Studio C++ core features"
gyp ERR! find VS - found VC++ toolset: v141
gyp ERR! find VS - missing any Windows SDK
gyp ERR! find VS could not find a version of Visual Studio 2017 or newer to use
gyp ERR! find VS looking for Visual Studio 2015
gyp ERR! find VS - not found
gyp ERR! find VS not looking for VS2013 as it is only supported up to Node.js 8
gyp ERR! find VS
gyp ERR! find VS valid versions for msvs_version:
gyp ERR! find VS - "2019"
gyp ERR! find VS - "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community"
gyp ERR! find VS
gyp ERR! find VS **************************************************************
gyp ERR! find VS You need to install the latest version of Visual Studio
gyp ERR! find VS including the "Desktop development with C++" workload.
gyp ERR! find VS For more information consult the documentation at:
gyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows
gyp ERR! find VS **************************************************************
gyp ERR! find VS
gyp ERR! configure error
gyp ERR! stack Error: Could not find any Visual Studio installation to use
gyp ERR! stack     at VisualStudioFinder.fail (C:\Users\Lenovo\AppData\Roaming\npm\node_modules\node-gyp\lib\find-visualstudio.js:121:47)
gyp ERR! stack     at C:\Users\Lenovo\AppData\Roaming\npm\node_modules\node-gyp\lib\find-visualstudio.js:74:16
gyp ERR! stack     at VisualStudioFinder.findVisualStudio2013 (C:\Users\Lenovo\AppData\Roaming\npm\node_modules\node-gyp\lib\find-visualstudio.js:351:14)
gyp ERR! stack     at C:\Users\Lenovo\AppData\Roaming\npm\node_modules\node-gyp\lib\find-visualstudio.js:70:14
gyp ERR! stack     at C:\Users\Lenovo\AppData\Roaming\npm\node_modules\node-gyp\lib\find-visualstudio.js:372:16
gyp ERR! stack     at C:\Users\Lenovo\AppData\Roaming\npm\node_modules\node-gyp\lib\util.js:54:7
gyp ERR! stack     at C:\Users\Lenovo\AppData\Roaming\npm\node_modules\node-gyp\lib\util.js:33:16
gyp ERR! stack     at ChildProcess.exithandler (child_process.js:390:5)
gyp ERR! stack     at ChildProcess.emit (events.js:400:28)
gyp ERR! stack     at maybeClose (internal/child_process.js:1058:16)
gyp ERR! System Windows_NT 6.3.9600
gyp ERR! command "C:\\Program Files (x86)\\nodejs\\node.exe" "C:\\Users\\Lenovo\\AppData\\Roaming\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\Lenovo\Desktop\xxxx\node_modules\ffi-napi
gyp ERR! node -v v14.18.0
gyp ERR! node-gyp -v v8.2.0
gyp ERR! not ok
npm WARN xxxx@1.0.0 No description
npm WARN xxxx@1.0.0 No repository field.

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.

So, I tried to node-gyp configure stuff but problems never end at this part. I have solved the former ones but now I get this error;

gyp: deps\libffi\libffi.gyp not found (cwd: C:\Users\Lenovo\Desktop\xxxx) while loading dependencies of 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:\Users\Lenovo\AppData\Roaming\npm\node_modules\node-gyp\lib\configure.js:353:16)
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 6.3.9600
gyp ERR! command "C:\\Program Files (x86)\\nodejs\\node.exe" "C:\\Users\\Lenovo\\AppData\\Roaming\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "configure"
gyp ERR! cwd C:\Users\Lenovo\Desktop\xxxx
gyp ERR! node -v v14.18.0
gyp ERR! node-gyp -v v8.2.0
gyp ERR! not ok

To add, I have made a file named libffi.gyp and copied its contents from github also. So there is a file like that yet it gives that error. I hope I can get some help here. Thanks in advance.

1 Answers

try setting msv version with npm config set msvs_version 2019, the logs are saying that you have 2019 but is not the chosen one... It didn't solve my issue, but mabe it will solve yours

Related