Open long1eu opened 1 year ago
Is there a way to debug this?
I have the exact same issue, and I can confirm this is an issue appearing with grpc-tools version 1.12.0. If I try the command with 1.11.3, it runs fine, but not with any of the 1.12 versions. So try running this: npm install -g grpc-tools@1.11.3
Reproduced with both node v14.16.1 and the latest v19.6.0, both installed using nvm for Windows. I have the same issue wether I only type "grpc_tools_node_protoc" or I type the full command with arguments. I know the command syntax is correct, because my grpc_tools_node_protoc command used to work, but since I tried on a fresh Windows install, I can't get the command to work anymore. Also, I tried the static_codegen example it also fails.
Here is the output I get, identical as the OP:
C:\Users\robil\AppData\Roaming\nvm\v19.6.0\node_modules\grpc-tools\bin\protoc.js:41
throw error;
^
Error: Command failed: C:\Users\robil\AppData\Roaming\nvm\v19.6.0\node_modules\grpc-tools\bin\protoc.exe --plugin=protoc-gen-grpc=C:\Users\robil\AppData\Roaming\nvm\v19.6.0\node_modules\grpc-tools\bin\grpc_node_plugin.exe --js_out=import_style=commonjs binary:../node/static_codegen/ --grpc_out=grpc_js:../node/static_codegen helloworld.proto
at ChildProcess.exithandler (node:child_process:419:12)
at ChildProcess.emit (node:events:512:28)
at maybeClose (node:internal/child_process:1098:16)
at Socket.<anonymous> (node:internal/child_process:456:11)
at Socket.emit (node:events:512:28)
at Pipe.<anonymous> (node:net:316:12) {
code: 3221225781,
killed: false,
signal: null,
cmd: 'C:\\Users\\robil\\AppData\\Roaming\\nvm\\v19.6.0\\node_modules\\grpc-tools\\bin\\protoc.exe --plugin=protoc-gen-grpc=C:\\Users\\robil\\AppData\\Roaming\\nvm\\v19.6.0\\node_modules\\grpc-tools\\bin\\grpc_node_plugin.exe --js_out=import_style=commonjs binary:../node/static_codegen/ --grpc_out=grpc_js:../node/static_codegen helloworld.proto'
}
Node.js v19.6.0
Any hints to make this command work with the latest versions?
I'm not personally experiencing the issue, but a few days a go, a colleague also run into this.
After trying to debug things, we were able to narrow it down to the protoc.exe
file specifically. If he ran executable directly from cmd/powershell/bash on windows it would complain about various missing dlls. After jumping through hoops to install lots of distributables from MS, and still having no luck, we ended up downgrading the package as noted above and it is working for him.
Prior to downgrading him, we compared hashes of his and my binaries and both were the same (as you'd expect), and after downgrading was then different (also expcted).
I suspect that his windows environment is just missing some libs that mine has, but as it stands for now he isn't able to run grpc-tools@1.12.3
like the rest of the team and is having to use grpc-tools@1.11.3
instead.
Looks like the cause of this is missing STDC DLLs that must have had some change to how they're packaged with the most recent release.
You can fix this by install the Visual Studio 2022 VCTools workload or potentially with a Visual C++ redistributable but I at least know the following works.
With choco you can run:
choco install visualstudio2022-workload-vctools --package-parameters "--includeRecommended"
I found you need to have these two components installed on Visual Studio Build Tools 2022:
MSVC v143 - VS 2022 C++ x64/x86 build tools (latest)
Windows Universal CRT SDK
The first one is obvious, but without the second component, grpc-tools >=1.12.0
won't work on Windows.
Problem description
Running protoc_plugin.js result in an error I can't debug or solve.
Reproduction steps
Environment
Additional context