#With Electron v27.1.2, getting ffi-napi error

128 messages · Page 1 of 1 (latest)

visual hollow
#

any suggestions , how to resolve it?

bold fulcrum
#

not if you don't give the full error and more info

visual hollow
#

ok let me shaare the complete error

bold fulcrum
#

can't you put it on discord directly?

#

I don't want to download a file

visual hollow
#

ok.. actully i was pasting it directly

#

automatically it got added to file

bold fulcrum
#

probably too big

visual hollow
#

\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

bold fulcrum
#

try to paste only what's relevant

visual hollow
#

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

bold fulcrum
#

hmm, remind me of something

#

What verison of ffi-napi ?

visual hollow
#

"ffi-napi": "^4.0.3"

bold fulcrum
#

ok, can you give me a bit more of the error please?

visual hollow
#

sure.. let me send the remainng content also

bold fulcrum
#

I want to check if it's a ModuleNotFoundError

visual hollow
#

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=
bold fulcrum
#

okay, see the error in this?

visual hollow
#

no... module notfound is not there

bold fulcrum
#

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
visual hollow
#

ok.. so this is my error in short

bold fulcrum
#

you can find some solution about this when you search for this error on Google

bold fulcrum
#

I mean, it's the reason of the fail

visual hollow
#

ok thank you.. will search for this.

bold fulcrum
visual hollow
#

thanks a lot.. will try solutions available on page

visual hollow
#

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

bold fulcrum
#

ahh, here it is

visual hollow
#

getting module not found also this time

bold fulcrum
#

it's a problem of compatibility

visual hollow
#

same thing giving both isues

bold fulcrum
visual hollow
#

how to resolve compatibility

bold fulcrum
#

If I check the correct repo, ffi-napi doesn't see to have been udpated for years

visual hollow
#

hmm..right

bold fulcrum
#

so It's not compatible with your version of Python

#

and maybe not with your version of Node either

visual hollow
#

python get installed automatocatlly with Node js installation

bold fulcrum
#

oh wait, I think I'm mistaken

#

the error must come from node-gyp, not ffi-napi

visual hollow
#

i refered this, with 27 electron, node js is 18.17

bold fulcrum
#

I suggest you update node-gyp to v10

visual hollow
#

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

bold fulcrum
#

I would have checked which library you use relies on node-gyp before doing that

visual hollow
#

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

bold fulcrum
#

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

visual hollow
#

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

bold fulcrum
#

you shared the whole error?

visual hollow
#

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

bold fulcrum
#

errr... I don't know, could be several things I guess

#

do you have windows-build-tools installed?

visual hollow
#

how to check? control panel/

bold fulcrum
#

yeah

#

C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\MSBuild.exe

#

something like this I guess

visual hollow
#

visual studio yes i have

bold fulcrum
#

okay, and with Visual Studio you can install the build tools

#

if it's not already done

visual hollow
#

ok

bold fulcrum
#

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

visual hollow
#

let me check with Visual studio first

bold fulcrum
#

I'm not even sure your problem is this

visual hollow
#

hmm

bold fulcrum
#

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

visual hollow
#

for VS 2017, it is desktop developemnt c++

#

already there

bold fulcrum
#

do you have MSBuild somewhere?

visual hollow
#

yes checked the path reported in error, it is there MSBuild.exe

visual hollow
#

really appreciate the inputs

bold fulcrum
#

If you donwgrade Python get back to the original version of node-gyp you had

visual hollow
#

ok

bold fulcrum
#

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

visual hollow
#

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

bold fulcrum
#

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

visual hollow
#

yes i have saved the file.. so no problem on that, i can restore it

#

i think i used this to install explicitly

bold fulcrum
#

remove node-gyp from your package.json and run npm install again to restore the version expected by your dependencies

visual hollow
#

sure

#

yes it is resumed now

bold fulcrum
#

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

visual hollow
#

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

bold fulcrum
#

I'm not sure it's a good idea to downgrade

visual hollow
#

u mean ffi-napi should be replaced with something new .. which is supported for Node js latest versions

bold fulcrum
#

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

visual hollow
#

ok will check for thatt also

bold fulcrum
visual hollow
#

looking into it 🙂

visual hollow
#

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?

bold fulcrum
#

sorry but I never used ffi-napi nor Koffi so I don't know how to use either