nodejs / node-gyp

Node.js native addon build tool
MIT License
9.94k stars 1.8k forks source link

Error building node-ffi-napi on Windows #2885

Closed basilbai closed 1 year ago

basilbai commented 1 year ago
npm ERR! code 1
npm ERR! path E:\demo\evp\node_modules\ffi-napi
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c node-gyp-build
npm ERR! �ڴ˽��������һ������һ����Ŀ����Ҫ���ò������ɣ������ӡ�/m�����ء�
npm ERR!   Preprocessing assembly file ..\..\..\deps\libffi\src\x86\win64_intel.preasm
npm ERR! E:\demo\evp\node_modules\ffi-napi\build\deps\libffi\ffi.targets(34,5): error MSB3686: �޷����� Xaml ���񡣱���ʧ�ܡ�  [E:\demo\evp\node_modules\ffi-napi\build\deps\libffi\ffi.vcxproj]
npm ERR! E:\demo\evp\node_modules\ffi-napi\build\deps\libffi\ffi.targets(34,5): error MSB3686: �����ռ䲻��ֱ�Ӱ����ֶλ򷽷�֮��ij�Ա [E:\demo\evp\node_modules\ffi-napi\build\deps\libffi\ffi.vcxproj]
npm ERR! E:\demo\evp\node_modules\ffi-napi\build\deps\libffi\ffi.targets(34,5): error MSB3686:  [E:\demo\evp\node_modules\ffi-napi\build\deps\libffi\ffi.vcxproj]
npm ERR! E:\demo\evp\node_modules\ffi-napi\build\deps\libffi\ffi.targets(34,5): error MSB4175: δ�ܴӳ��򼯡�Microsoft.Build.Tasks.Core���������񹤳���XamlTaskFactory����δ�������������õ������ʵ���� [E:\demo\evp\node_modules\ffi-napi\build\deps\libffi\ffi.vcxproj]
npm ERR!   nothing.c
npm ERR!   win_delay_load_hook.cc
npm ERR!   nothing.vcxproj -> E:\demo\evp\node_modules\ffi-napi\build\Release\\nothing.lib
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@9.4.0
npm ERR! gyp info using node@16.18.0 | win32 | x64
npm ERR! gyp info find Python using Python version 3.11.4 found at "C:\Python311\python.exe"
npm ERR! gyp info find VS using VS2017 (15.9.33801.237) found at:
npm ERR! gyp info find VS "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools"
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\\@npmcli\\run-script\\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   'E:\\demo\\evp\\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\\@npmcli\\run-script\\node_modules\\node-gyp\\addon.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   'C:\\Users\\baico\\AppData\\Local\\node-gyp\\Cache\\16.18.0\\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\\baico\\AppData\\Local\\node-gyp\\Cache\\16.18.0',
npm ERR! gyp info spawn args   '-Dnode_gyp_dir=C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\@npmcli\\run-script\\node_modules\\node-gyp',
npm ERR! gyp info spawn args   '-Dnode_lib_file=C:\\\\Users\\\\baico\\\\AppData\\\\Local\\\\node-gyp\\\\Cache\\\\16.18.0\\\\<(target_arch)\\\\node.lib',
npm ERR! gyp info spawn args   '-Dmodule_root_dir=E:\\demo\\evp\\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   'E:\\demo\\evp\\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\BuildTools\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\BuildTools\MSBuild\15.0\Bin\MSBuild.exe` failed with exit code: 1
npm ERR! gyp ERR! stack     at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\run-script\node_modules\node-gyp\lib\build.js:203:23)
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.22621
npm ERR! gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\@npmcli\\run-script\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd E:\demo\evp\node_modules\ffi-napi
npm ERR! gyp ERR! node -v v16.18.0
npm ERR! gyp ERR! node-gyp -v v9.4.0
npm ERR! gyp ERR! not ok
cclauss commented 1 year ago

https://github.com/nodejs/node-gyp/labels/ffi-napi

hnmr293 commented 11 months ago

For your information:

I had encountered the similar error with the message:

  Preprocessing assembly file ..\..\..\deps\libffi\src\x86\win64_intel.preasm
  '"call"' は、内部コマンドまたは外部コマンド、
  操作可能なプログラムまたはバッチ ファイルとして認識されていません。
D:\tmp\node-ffi-napi\build\deps\libffi\ffi.targets(34,5): error MSB3721: コマンド "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"" はコード 1 で終了しました。 [D:\tmp\node-ffi-napi\build\deps\libffi\ffi.vcxproj]
  nothing.c
  win_delay_load_hook.cc
  nothing.vcxproj -> D:\tmp\node-ffi-napi\build\Release\\nothing.lib
gyp ERR! build error

(translation: '"call"' is not recognized as an internal or external command, operable program or batch file)

I found it in deps/libffi/libffi.gpy:L77. Here:

            'action': [
              'call',
              'preprocess_asm.cmd',
                'include',

Then I patched like this:

            'action': [
              '../../../deps/libffi/preprocess_asm.cmd',
                'include',

It works for me.

katejou commented 9 months ago

Thank you @hnmr293 for saving me!

AlePro12 commented 7 months ago

I downgraded the version of node-gyp to v9.4.0 and it worked

fractalfantasy commented 3 months ago

have thy fixed this yet?

1AoB commented 2 months ago

i also meet this problem

cclauss commented 2 months ago

Wrong repo. Please make requests at https://github.com/node-ffi-napi/node-ffi-napi