electron(일렉트론)

일렉트론 - ffi-napi 설치 오류 해결

믿을수없는맛 2025. 6. 14. 21:58
반응형

Java Spring만 하다 일렉트론으로 클라이언트 프로그램을 만들게 되었다.

코어로직은 c로 작성하고, dll로 변환하여 일렉트론에서 사용하려고 ffi-napi를 설치하려고 했다.

npm install ffi-napi

하지만 무수한 error들의 악수 요청..

npm error code 1
npm error path C:\Users\사용자\IdeaProjects\프로젝트명\node_modules\ffi-napi
npm error command failed
npm error command C:\WINDOWS\system32\cmd.exe /d /s /c node-gyp-build
npm error nothing.c
npm error   win_delay_load_hook.cc
npm error   nothing.vcxproj -> C:\Users\사용자\IdeaProjects\프로젝트명\node_modules\ffi-napi\build\Release\\nothing.lib
npm error   Preprocessing assembly file ..\..\..\deps\libffi\src\x86\win64_intel.preasm
npm error   win64_intel.preasm
npm error   Building assembly file Release\obj\ffi\\win64_intel.asm
npm error    Assembling: Release\obj\ffi\win64_intel.asm
npm error   prep_cif.c
npm error   types.c
npm error   raw_api.c
npm error   java_raw_api.c
npm error   closures.c
npm error   ffiw64.c
npm error   win_delay_load_hook.cc
npm error   ffi.vcxproj -> C:\Users\사용자\IdeaProjects\프로젝트명\node_modules\ffi-napi\build\Release\\libffi.lib
npm error   ffi.cc
npm error C:\Users\사용자\IdeaProjects\프로젝트명\node_modules\get-uv-event-loop-napi-h\include\get-uv-event-loop-napi.h(26,30): error C2440: '=': 'napi_status (__cdecl *)(node_api_basic_env,uv_loop_s **)'에서 'get_uv_event_loop::get_uv_event_loop_fn'(으)로 변환할 수 없습니다. [C:\Users\사용자\IdeaProjects\프로젝트명\node_modules\ffi-napi\build\ffi_bindings.vcxproj]
npm error   (소스 파일 '../src/ffi.cc'을(를) 컴파일하는 중)
npm error       C:\Users\사용자\IdeaProjects\프로젝트명\node_modules\get-uv-event-loop-napi-h\include\get-uv-event-loop-napi.h(26,30):
npm error       변환하려면 reinterpret_cast, C 스타일 캐스트 또는 괄호가 있는 함수 스타일 캐스트가 필요합니다.
npm error gyp info it worked if it ends with ok
npm error gyp info using node-gyp@9.4.1
npm error gyp info using node@22.16.0 | win32 | x64
npm error (node:10816) [DEP0060] DeprecationWarning: The `util._extend` API is deprecated. Please use Object.assign() instead.
npm error (Use `node --trace-deprecation ...` to show where the warning was created)
npm error gyp info find Python using Python version 3.8.0 found at "C:\Users\사용자\AppData\Local\Programs\Python\Python38\python.exe"
npm error gyp info find VS using VS2022 (17.13.35931.197) found at:
npm error gyp info find VS "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools"
npm error gyp info find VS run with --verbose for detailed information
npm error gyp info spawn C:\Users\사용자\AppData\Local\Programs\Python\Python38\python.exe
npm error gyp info spawn args [
npm error gyp info spawn args   'C:\\Users\\사용자\\IdeaProjects\\프로젝트명\\node_modules\\node-gyp\\gyp\\gyp_main.py',
npm error gyp info spawn args   'binding.gyp',

 

찾아보니 node.js 17이상 버전에 발생하는 오류라고 하는 것 같다..

https://github.com/node-ffi-napi/node-ffi-napi/issues/275#issuecomment-2146501586

 

node-gyp rebuild failed · Issue #275 · node-ffi-napi/node-ffi-napi

OS:win11 node -v v20.14.0 vs2022 community run npm install ffi-napi: $ npm install ffi-napi npm warn deprecated gar@1.0.4: Package no longer supported. Contact Support at https://www.npmjs.com/supp...

github.com

 

그래서 16버전으로 변경했더니 문제 없이 install 되었다..

필자는 ffi-napi를 사용해야 하는 사정이 있어서 이렇게 사용했지만 여러분들은 다른 라이브러리를 설치하는것을 추천한다. 개인적으로는 koffi가 사용중에 문제가 거의 없었다.

반응형