#With Electron v27.1.2, getting ffi-napi error
128 messages · Page 1 of 1 (latest)
not if you don't give the full error and more info
probably too big
\Cyber\Source\Self\Auth\Electron_GUI_Application>npm run dist
[email protected] dist
electron-builder
• electron-builder version=22.14.13 os=10.0.19045
• loaded configuration file=package.json ("build" field)
• writing effective config file=dist\builder-effective-config.yaml
• rebuilding native dependencies [email protected], [email protected] platform=win32 arch=x64
⨯ cannot execute cause=exit status 1
errorOut=npm ERR! code 1
npm ERR! path D:\Cyber\Source\Self\Auth\Electron_GUI_Application\node_modules\ffi-napi
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c node-gyp-build
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using [email protected]
npm ERR! gyp info using [email protected] | win32 | x64
try to paste only what's relevant
npm ERR! gyp info find Python using Python version 3.11.5 found at "C:\Python311\python.exe"
npm ERR! gyp info find VS using VS2017 (15.9.33027.88) found at:
npm ERR! gyp info find VS "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional"
npm ERR! gyp info find VS run with --verbose for detailed information
npm ERR! gyp info spawn C:\Python311\python.exe
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args 'C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\gyp_main.py',
npm ERR! gyp info spawn args 'binding.gyp',
npm ERR! gyp info spawn args '-f',
npm ERR! gyp info spawn args 'msvs',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args 'D:\Cyber\Source\Self\Auth\Electron_GUI_Application\node_modules\ffi-napi\build\config.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args 'C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\addon.gypi',
npm ERR! gyp info spawn args '-I',
yes, just did... if you can go through and let me know
"ffi-napi": "^4.0.3"
ok, can you give me a bit more of the error please?
sure.. let me send the remainng content also
I want to check if it's a ModuleNotFoundError
npm ERR! gyp info spawn args 'C:\Users\swati.sharma\.electron-gyp\12.2.3\include\node\common.gypi',
npm ERR! gyp info spawn args '-Dlibrary=shared_library',
npm ERR! gyp info spawn args '-Dvisibility=default',
npm ERR! gyp info spawn args '-Dnode_root_dir=C:\Users\swati.sharma\.electron-gyp\12.2.3',
npm ERR! gyp info spawn args '-Dnode_gyp_dir=C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp',
npm ERR! gyp info spawn args '-Dnode_lib_file=C:\\Users\\swati.sharma\\.electron-gyp\\12.2.3\\<(target_arch)\\node.lib',
npm ERR! gyp info spawn args '-Dmodule_root_dir=D:\Cyber\Source\Self\Auth\Electron_GUI_Application\node_modules\ffi-napi',
npm ERR! gyp info spawn args '-Dnode_engine=v8',
npm ERR! gyp info spawn args '--depth=.',
npm ERR! gyp info spawn args '--no-parallel',
npm ERR! gyp info spawn args '--generator-output',
npm ERR! gyp info spawn args 'D:\Cyber\Source\Self\Auth\Electron_GUI_Application\node_modules\ffi-napi\build',
npm ERR! gyp info spawn args '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! gyp: name 'openssl_fips' is not defined while evaluating condition 'openssl_fips != ""' in binding.gyp while trying to load binding.gyp
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: gyp failed with exit code: 1
npm ERR! gyp ERR! stack at ChildProcess.onCpExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:284:16)
npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:513:28)
npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:293:12)
npm ERR! gyp ERR! System Windows_NT 10.0.19045
npm ERR! gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd D:\Cyber\Source\Self\Auth\Electron_GUI_Application\node_modules\ffi-napi
npm ERR! gyp ERR! node -v v16.20.2
npm ERR! gyp ERR! node-gyp -v v9.1.0
npm ERR! gyp ERR! not ok
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\swati.sharma\AppData\Local\npm-cache\_logs\2023-11-28T11_21_21_243Z-debug-0.log
command='C:\Program Files\nodejs\node.exe' 'C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js' rebuild [email protected] [email protected]
workingDir=
okay, see the error in this?
no... module notfound is not there
just so you know if it happens to you again
the actual error is this:
npm ERR! gyp: name 'openssl_fips' is not defined while evaluating condition 'openssl_fips != ""' in binding.gyp while trying to load binding.gyp
ok.. so this is my error in short
you can find some solution about this when you search for this error on Google
yeah
I mean, it's the reason of the fail
ok thank you.. will search for this.
I think this issue is similar:
https://github.com/nodejs/node-gyp/issues/2673
thanks a lot.. will try solutions available on page
on executing the command: npm run dist
npm ERR! File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\input.py", line 19, in <module>
npm ERR! from distutils.version import StrictVersion
npm ERR! ModuleNotFoundError: No module named 'distutils'
npm ERR! gyp ERR! configure error
ahh, here it is
getting module not found also this time
it's a problem of compatibility
same thing giving both isues
distutils has been removed in Python v3.12
https://docs.python.org/3/whatsnew/3.12.html#summary-release-highlights
how to resolve compatibility
If I check the correct repo, ffi-napi doesn't see to have been udpated for years
hmm..right
so It's not compatible with your version of Python
and maybe not with your version of Node either
python get installed automatocatlly with Node js installation
Electron frequently releases major versions alongside every other Chromium release. This document focuses on the release cadence and version support policy. For a more in-depth guide on our git branches and how Electron uses semantic versions, check out our Electron Versioning doc.
i refered this, with 27 electron, node js is 18.17
I suggest you update node-gyp to v10
ok
ok let me try
is it right way of doing it
PS D:\Cyber\Source\Self\Auth\Electron_GUI_Application> npm install [email protected]
npm WARN cleanup Failed to remove some directories [
npm WARN cleanup [
npm WARN cleanup 'D:\Cyber\Source\Self\Auth\Electron_GUI_Application\node_modules\iconv-corefoundation',
npm WARN cleanup [Error: EPERM: operation not permitted, lstat 'D:\Cyber\Source\Self\Auth\Electron_GUI_Application\node_modules\iconv-corefoundation\node_modules\node-addon-api\src\util.h'] {
npm WARN cleanup errno: -4048,
npm WARN cleanup code: 'EPERM',
npm WARN cleanup syscall: 'lstat',
npm WARN cleanup path: 'D:\Cyber\Source\Self\Auth\Electron_GUI_Application\node_modules\iconv-corefoundation\node_modules\node-addon-api\src\util.h'
npm WARN cleanup }
npm WARN cleanup ]
npm WARN cleanup ]
added 69 packages, and audited 363 packages in 7s
49 packages are looking for funding
run npm fund for details
found 0 vulnerabilities
I would have checked which library you use relies on node-gyp before doing that
which library means
did not get ur point
after chnging node-gyp on building code getting this
npm ERR! gyp info spawn C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\MSBuild.exe
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args 'build\binding.sln',
npm ERR! gyp info spawn args '/clp:Verbosity=minimal',
npm ERR! gyp info spawn args '/nologo',
npm ERR! gyp info spawn args '/p:Configuration=Release;Platform=x64'
npm ERR! gyp info spawn args ]
npm ERR! gyp ERR! build error
npm ERR! gyp ERR! stack Error: C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\MSBuild.exe failed with exit code: 1
npm ERR! gyp ERR! stack at ChildProcess.<anonymous> (D:\Cyber\Source\Self\Auth\Electron_GUI_Application\node_modules\node-gyp\lib\build.js:209:23)
npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:514:28)
npm ERR! gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:291:12)
npm ERR! gyp ERR! System Windows_NT 10.0.19045
npm ERR! gyp ERR! command "C:\Program Files\nodejs\node.exe" "D:\Cyber\Source\Self\Auth\Electron_GUI_Application\node_modules\node-gyp\bin\node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd D:\Cyber\Source\Self\Auth\Electron_GUI_Application\node_modules\ffi-napi
npm ERR! gyp ERR! node -v v18.17.1
npm ERR! gyp ERR! node-gyp -v v10.0.0
no clear error in this, search for the line stating the actual error
and I mean that if a library you use has the dependency node-gyp then you might no be able to update it just like this
npm ERR! gyp ERR! stack Error: C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\MSBuild.exe failed with exit code: 1
npm ERR! gyp ERR! stack at ChildProcess.<anonymous> (D:\Cyber\Source\Self\Auth\Electron_GUI_Application\node_modules\node-gyp\lib\build.js:209:23)
npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:514:28)
npm ERR! gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:291:12)
npm ERR! gyp ERR! System Windows_NT 10.0.19045
this has error
you shared the whole error?
ok will share complete
PS D:\Cyber\Source\Self\Auth\Electron_GUI_Application> npm run dist
[email protected] dist
electron-builder
• electron-builder version=24.9.1 os=10.0.19045
• loaded configuration file=package.json ("build" field)
• writing effective config file=dist\builder-effective-config.yaml
• rebuilding native dependencies [email protected], [email protected] platform=win32 arch=x64
⨯ cannot execute cause=exit status 1
errorOut=npm ERR! code 1
npm ERR! path D:\Cyber\Source\Self\Auth\Electron_GUI_Application\node_modules\ffi-napi
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c node-gyp-build
npm ERR! Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
npm ERR! win_delay_load_hook.cc
npm ERR! nothing.vcxproj -> D:\Cyber\Source\Self\Auth\Electron_GUI_Application\node_modules\ffi-napi\build\Release\nothing.lib
npm ERR! Preprocessing assembly file ......\deps\libffi\src\x86\win64_intel.preasm
npm ERR! '"call"' is not recognized as an internal or external command,
npm ERR! operable program or batch file.
npm ERR! D:\Cyber\Source\Self\Auth\Electron_GUI_Application\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 1. [D:\Cyber\Source\Self\Auth\Electron_GUI_Application\node_modules\ffi-napi\build\deps\libffi\ffi.vcxproj]
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using [email protected]
npm ERR! gyp info using [email protected] | win32 | x64
npm ERR! gyp info find Python using Python version 3.12.0 found at "C:\Python312\python.exe"
npm ERR! gyp info find VS using VS2017 (15.9.33027.88) found at:
npm ERR! gyp info find VS "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional"
npm ERR! gyp info find VS run with --verbose for detailed information
npm ERR! gyp info spawn C:\Python312\python.exe
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args 'D:\Cyber\Source\Self\Auth\Electron_GUI_Application\node_modules\node-gyp\gyp\gyp_main.py',
npm ERR! gyp info spawn args 'binding.gyp',
npm ERR! gyp info spawn args '-f',
npm ERR! gyp info spawn args 'msvs',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args 'D:\Cyber\Source\Self\Auth\Electron_GUI_Application\node_modules\ffi-napi\build\config.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args 'D:\Cyber\Source\Self\Auth\Electron_GUI_Application\node_modules\node-gyp\addon.gypi', npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args 'C:\Users\swati.sharma\.electron-gyp\27.1.3\include\node\common.gypi',
npm ERR! gyp info spawn args '-Dlibrary=shared_library',
npm ERR! gyp info spawn args '-Dvisibility=default',
npm ERR! gyp info spawn args '-Dnode_root_dir=C:\Users\swati.sharma\.electron-gyp\27.1.3',
npm ERR! gyp info spawn args '-Dnode_gyp_dir=D:\Cyber\Source\Self\Auth\Electron_GUI_Application\node_modules\node-gyp',
npm ERR! gyp info spawn args '-Dnode_lib_file=C:\\Users\\swati.sharma\\.electron-gyp\\27.1.3\\<(target_arch)\\node.lib',
npm ERR! gyp info spawn args '-Dmodule_root_dir=D:\Cyber\Source\Self\Auth\Electron_GUI_Application\node_modules\ffi-napi',
npm ERR! gyp info spawn args '-Dnode_engine=v8',
npm ERR! gyp info spawn args '--depth=.',
npm ERR! gyp info spawn args '--no-parallel',
npm ERR! gyp info spawn args '--generator-output',
npm ERR! gyp info spawn args 'D:\Cyber\Source\Self\Auth\Electron_GUI_Application\node_modules\ffi-napi\build',
npm ERR! gyp info spawn args '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! gyp info spawn C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\MSBuild.exe
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args 'build\binding.sln',
npm ERR! gyp info spawn args '/clp:Verbosity=minimal',
npm ERR! gyp info spawn args '/nologo',
npm ERR! gyp info spawn args '/p:Configuration=Release;Platform=x64'
npm ERR! gyp info spawn args ]
npm ERR! gyp ERR! build error
npm ERR! gyp ERR! stack Error: C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\MSBuild.exe failed with exit code: 1
npm ERR! gyp ERR! stack at ChildProcess.<anonymous> (D:\Cyber\Source\Self\Auth\Electron_GUI_Application\node_modules\node-gyp\lib\build.js:209:23)
npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:514:28)
npm ERR! gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:291:12)
npm ERR! gyp ERR! System Windows_NT 10.0.19045
npm ERR! gyp ERR! command "C:\Program Files\nodejs\node.exe" "D:\Cyber\Source\Self\Auth\Electron_GUI_Application\node_modules\node-gyp\bin\node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd D:\Cyber\Source\Self\Auth\Electron_GUI_Application\node_modules\ffi-napi
npm ERR! gyp ERR! node -v v18.17.1
npm ERR! gyp ERR! node-gyp -v v10.0.1
npm ERR! gyp ERR! not ok
npm ERR! A complete log of this run can be found in: C:\Users\swati.sharma\AppData\Local\npm-cache\_logs\2023-12-01T08_21_09_227Z-debug-0.log
command='C:\Program Files\nodejs\node.exe' 'C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js' rebuild [email protected] [email protected]
workingDir=
done
errr... I don't know, could be several things I guess
do you have windows-build-tools installed?
how to check? control panel/
yeah
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\MSBuild.exe
something like this I guess
visual studio yes i have
okay, and with Visual Studio you can install the build tools
if it's not already done
ok
node_gyp needs this to work:
https://github.com/nodejs/node-gyp#on-windows
On SO people say you can install the tools using:
npm install --global windows-build-tool
But I never tried so I can't tell if it will work
I do remember installing the tools with Visual Studio, some years ago
let me check with Visual studio first
I'm not even sure your problem is this
hmm
in the end, maybe you just use a library not compatible with the version of Python you use
downgrading Python could be enough
well, we know node-gyp 9 is incompatible with the version of Python you have at least
do you have MSBuild somewhere?
yes checked the path reported in error, it is there MSBuild.exe
ok.. with check python
really appreciate the inputs
If you donwgrade Python get back to the original version of node-gyp you had
ok
according to the logs, when you use node-gyp 10 the version of node used in 18, while with the version 9 it was node 16
ffi-napi doesn't seem compatible with node 18
in package.json.. there was no node-gyp .. but now i have installed it so, not sure if it was there or with which version
don't you use git to track changes?
you can restore your package.json as before
I don't think you would have installed node-gyp yourself
yes i have saved the file.. so no problem on that, i can restore it
node install [email protected]
i think i used this to install explicitly
remove node-gyp from your package.json and run npm install again to restore the version expected by your dependencies
as long as you use ffi-napi you will have to stick to node 16
sounds like a bad plan
you should find another library, this one is deprecated
hmm ok.. requiremnt was to install everuythng latest... but yes if things are not compatible , then its better to dwngrade.. but need to confirm.. that beyond this version it is not possible to upgrade
I'm not sure it's a good idea to downgrade
u mean ffi-napi should be replaced with something new .. which is supported for Node js latest versions
you will have the stay on node 16 and it means at one point you won't be able to use the latest version of Electron either
yes
something maintained
ok will check for thatt also
noted
some people suggest koffi
https://github.com/node-ffi-napi/node-ffi-napi/issues/247
looking into it 🙂
hi, plz can you help how to use dll in Koffi
with ffi-napi.. syntax was:
const hUSAuthClientLib = new ffi.Library('./../hUSAuthClient.dll', {
'InitializeAuthClient' : [ 'uint32', [clientSettingPtr] ],
'DeinitializeAuthClient': [ 'void', [] ]});
how it should be modified with Koffi?
sorry but I never used ffi-napi nor Koffi so I don't know how to use either