Blizzard / node-rdkafka

Node.js bindings for librdkafka
MIT License
2.12k stars 397 forks source link

nod-rdkafka cannot be installed on Windows #1097

Closed KasimAhmic closed 1 month ago

KasimAhmic commented 1 month ago

Environment Information

Steps to Reproduce

  1. Run npm i node-rdkafka on a Windows 10 machine

node-rdkafka Configuration Settings N/A

Additional context

It complains about Python not being found despite me having it installed and having it in the path. Also further down, you can see that node-gyp has successfully detected it.

PS E:\Work\Xcira\auctionapi> npm i node-rdkafka
npm ERR! code 1
npm ERR! path E:\Work\Xcira\auctionapi\node_modules\node-rdkafka
npm ERR! command failed
npm ERR! command C:\windows\system32\cmd.exe /d /s /c node-gyp rebuild
npm ERR! Getting librdkafka from nuget
npm ERR!   '"python"' is not recognized as an internal or external command,
npm ERR!   operable program or batch file.
npm ERR! C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(254,5): error MSB8066: Custom build for '..\deps\windows-install.py' exited with code 1. [E:\Work\Xcira\auctionapi\node_modules\node-rdkafka\build\node-librdkafka.vcxproj]
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@10.2.0
npm ERR! gyp info using node@20.11.0 | win32 | x64
npm ERR! gyp info find Python using Python version 3.12.1 found at "C:\Program Files\Python312\python.exe"
npm ERR! gyp info find VS using VS2022 (17.11.35219.272) found at:
npm ERR! gyp info find VS "C:\Program Files\Microsoft Visual Studio\2022\Community"
npm ERR! gyp info find VS run with --verbose for detailed information
npm ERR! gyp info spawn C:\Program Files\Python312\python.exe
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args 'E:\\Work\\Xcira\\auctionapi\\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:\\Work\\Xcira\\auctionapi\\node_modules\\node-rdkafka\\build\\config.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args 'E:\\Work\\Xcira\\auctionapi\\node_modules\\node-gyp\\addon.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args 'C:\\Users\\kasim\\AppData\\Local\\node-gyp\\Cache\\20.11.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\\kasim\\AppData\\Local\\node-gyp\\Cache\\20.11.0',
npm ERR! gyp info spawn args '-Dnode_gyp_dir=E:\\Work\\Xcira\\auctionapi\\node_modules\\node-gyp',
npm ERR! gyp info spawn args '-Dnode_lib_file=C:\\\\Users\\\\kasim\\\\AppData\\\\Local\\\\node-gyp\\\\Cache\\\\20.11.0\\\\<(target_arch)\\\\node.lib',
npm ERR! gyp info spawn args '-Dmodule_root_dir=E:\\Work\\Xcira\\auctionapi\\node_modules\\node-rdkafka',
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:\\Work\\Xcira\\auctionapi\\node_modules\\node-rdkafka\\build',
npm ERR! gyp info spawn args '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! gyp info spawn C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\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\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\MSBuild.exe` failed with exit code: 1
npm ERR! gyp ERR! stack at ChildProcess.<anonymous> (E:\Work\Xcira\auctionapi\node_modules\node-gyp\lib\build.js:216:23)
npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:518:28)
npm ERR! gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:294:12)
npm ERR! gyp ERR! System Windows_NT 10.0.19045
npm ERR! gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "E:\\Work\\Xcira\\auctionapi\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd E:\Work\Xcira\auctionapi\node_modules\node-rdkafka
npm ERR! gyp ERR! node -v v20.11.0
npm ERR! gyp ERR! node-gyp -v v10.2.0
npm ERR! gyp ERR! not ok

npm ERR! A complete log of this run can be found in: C:\Users\kasim\AppData\Local\npm-cache\_logs\2024-09-27T22_33_05_371Z-debug-0.log
KasimAhmic commented 1 month ago

Played around with this for a bit, tried older versions that I know I was able to install in the past, cleared npm cache, etc, etc, and nothing. In desperation I restarted VS Code and it magically started working again... No idea what that was about but I'll close this cause this is clearly a me issue.