openwallet-foundation/credo-ts

ffi-napi issue on windows while installation

Opened this issue · 3 comments

I am facing below issue on my windows machine while installation.

@TimoGlastra @berendsliedrecht @genaris - Do you have any idea for this?

It fails to build 'ffi-napi' related package.

PS D:\Project\credo-ts> pnpm install
Scope: all 19 workspace projects
Lockfile is up to date, resolution step is skipped
Packages: +1646
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Progress: resolved 1646, reused 1646, downloaded 0, added 0, done
node_modules/.pnpm/@mattrglobal+node-bbs-signatures@0.18.1/node_modules/@mattrglobal/node-bbs-signatnode_modules/.pnpm/@mattrglobal+node-bbs-signatures@0.18.1/node_modules/@mattrglobal/node-bbs-signatures: Running install script, failed in 1.5s (skipped as optional)
node_modules/.pnpm/@2060.io+ffi-napi@4.0.9/node_modules/@2060.io/ffi-napi: Running install script, failed in 6s
.../node_modules/@2060.io/ffi-napi install$ node-gyp-build
│ D:\Project\credo-ts\node_modules.pnpm@2060.io+ffi-napi@4.0.9\node_modules@2060.io\ffi-napi>i…
│ gyp info it worked if it ends with ok
│ gyp info using node-gyp@10.1.0
│ gyp info using node@18.20.4 | win32 | x64
│ gyp info find Python using Python version 3.12.6 found at "C:\Users\Rinkal Bhojani\AppData\Loca…
│ gyp info find VS using VS2022 (17.11.35303.130) found at:
│ gyp info find VS "C:\Program Files\Microsoft Visual Studio\2022\Community"
│ gyp info find VS run with --verbose for detailed information
│ gyp info spawn C:\Users\Rinkal Bhojani\AppData\Local\Programs\Python\Python312\python.exe
│ gyp info spawn args [
│ gyp info spawn args 'C:\Users\Rinkal Bhojani\AppData\Roaming\npm\node_modules\pnpm\dist…
│ gyp info spawn args 'binding.gyp',
│ gyp info spawn args '-f',
│ gyp info spawn args 'msvs',
│ gyp info spawn args '-I',
│ gyp info spawn args 'D:\Project\credo-ts\node_modules\.pnpm\@2060.io+ffi-napi@4.0.9\node_…
│ gyp info spawn args '-I',
│ gyp info spawn args 'C:\Users\Rinkal Bhojani\AppData\Roaming\npm\node_modules\pnpm\dist…
│ gyp info spawn args '-I',
│ gyp info spawn args 'C:\Users\Rinkal Bhojani\AppData\Local\node-gyp\Cache\18.20.4\inclu…
│ gyp info spawn args '-Dlibrary=shared_library',
│ gyp info spawn args '-Dvisibility=default',
│ gyp info spawn args '-Dnode_root_dir=C:\Users\Rinkal Bhojani\AppData\Local\node-gyp\Cache…
│ gyp info spawn args '-Dnode_gyp_dir=C:\Users\Rinkal Bhojani\AppData\Roaming\npm\node_modu…
│ gyp info spawn args '-Dnode_lib_file=C:\\Users\\Rinkal Bhojani\\AppData\\Local\\node-…
│ gyp info spawn args '-Dmodule_root_dir=D:\Project\credo-ts\node_modules\.pnpm\@2060.io+ffi…
│ gyp info spawn args '-Dnode_engine=v8',
│ gyp info spawn args '--depth=.',
│ gyp info spawn args '--no-parallel',
│ gyp info spawn args '--generator-output',
│ gyp info spawn args 'D:\Project\credo-ts\node_modules\.pnpm\@2060.io+ffi-napi@4.0.9\node_…
│ gyp info spawn args '-Goutput_dir=.'
│ gyp info spawn args ]
│ gyp info spawn C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\MSBu…
│ gyp info spawn args [
│ gyp info spawn args 'build\binding.sln',
│ gyp info spawn args '/clp:Verbosity=minimal',
│ gyp info spawn args '/nologo',
│ gyp info spawn args '/p:Configuration=Release;Platform=x64'
│ gyp info spawn args ]
│ nothing.c
│ nothing.vcxproj -> D:\Project\credo-ts\node_modules.pnpm@2060.io+ffi-napi@4.0.9\node_module…
│ Preprocessing assembly file ......\deps\libffi\src\x86\win64_intel.preasm
│ '"call"' is not recognized as an internal or external command,
│ operable program or batch file.
│ D:\Project\credo-ts\node_modules.pnpm@2060.io+ffi-napi@4.0.9\node_modules@2060.io\ffi-napi\b…
│ gyp ERR! build error
│ gyp ERR! stack Error: `C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\…
│ gyp ERR! stack at ChildProcess. (C:\Users\Rinkal Bhojani\AppData\Roaming\npm\node_mo…
│ gyp ERR! stack at ChildProcess.emit (node:events:517:28)
│ gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:292:12)
│ gyp ERR! System Windows_NT 10.0.19045
│ gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Users\Rinkal Bhojani\AppData\Roa…
│ gyp ERR! cwd D:\Project\credo-ts\node_modules.pnpm@2060.io+ffi-napi@4.0.9\node_modules@2060.…
│ gyp ERR! node -v v18.20.4
│ gyp ERR! node-gyp -v v10.1.0
│ gyp ERR! not ok
└─ Failed in 6s at D:\Project\credo-ts\node_modules.pnpm@2060.io+ffi-napi@4.0.9\node_modules@2060.io\ffi-napi
 ELIFECYCLE  Command failed with exit code 1.

Am I missing something or needs to changed

Maybe this is related to the comment from @btsimonh in nodejs/node#52240 (comment). I'll check as soon as I can get a Windows machine, but in the meantime probably it may work for you if you force node-gyp-build to version 4.8.2, i.e. add it to package.json's resolutions field:

resolutions: {
...
"node-gyp-build": "4.8.2",
...
}

resolutions: { "node-gyp-build": "4.8.2" }

@genaris - I tried this but got the same error.

'"call"' is not recognized as an internal or external command,

see the mods I mention in node-ffi-napi/node-ffi-napi#270 - the one about libffi.gyp.