-
-
Notifications
You must be signed in to change notification settings - Fork 75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to run on windows? #51
Comments
Hey @rahulv4667 Thank you for this great finding. Unfortunately, I do not have a windows machine that I can work with to fix this but I can definitely put you in the right spot if you want to send a PR for this. Since I do the development on Unix-like machines I never had this issue but I would expect it to work since npm creates a wrapper on windows. Maybe the problem that you are having is because of the direct invocation of the binary which is designed for unix systems. The only solution that I see is having an executable file called But even before that, I feel like you can implement a workaround by running a set of commands and create an appropriate executable file in place then send it as a PR. 1 - Add .cmd as a suffix to path (it must be already there alongside normal bin that is designed for unix) If there is no such file then 2- Create it manually
and try to invoke the |
Sure. I was able to get it running by calling the index file. But, I had to hard code the file location. To set the right location dynamically, I think it needs to check the local and global installation folders. Will try to write the script by tomorrow and make a pull request. But I didn't understand step 1(add .cmd as a suffix to path) in your message. Let me see if I understood what I need to do.
Please let me know if I am missing anything else. |
I mean there must be a binary that is specifically generated for "windows" with possibly ".cmd" (".ps" in some cases) extension. so in order to use the correct one when invoking protoc with "--plugin" option present, you need to invoke tell it to use the one with correct extension. so in your case it was |
Alternatively, installing the plugin globally rather than locally might help. As far as I am concerned, you ran into this problem because |
Oh. I understood that.
No, installing globally didn't solve the problem. The problem wasn't with path. It's, as you said, not having a batch script. I have created the batch script. You can look at it here. I will install bazel and test if it is building properly after making necessary changes to build files. Then, make the pull request. Or if you prefer just the batch script, I could make it now. |
I am facing this error when running
|
Bazel has a lot of problems with windows still so I wouldn’t recommend that you try to build it on windows. So if this solved your problem then we can get it merged when you could send a PR with the batch script. I can additionally integrate Github workflows so we can make sure in the future that it works on a windows machine too. Refer to matrix testing here: protoc-gen-ts/.github/workflows/test.yaml Lines 16 to 17 in e99f990
|
Hey @rahulv4667 We have landed a fix for this on 0.8.0. Let me know if it works for you! |
Hello, I am having trouble trying to compile on windows10.
.\protoc.exe -I=proto_src --ts_out=dist message.proto
throws'protoc-gen-ts' is not recognized as an internal or external command, operable program or batch file. --ts_out: protoc-gen-ts: Plugin failed with status code 1.
error.And when I use
.\protoc.exe --plugin=protoc-gen-ts=<absolute_path_to_project>/node_modules/protoc-gen-ts/bin/protoc-gen-ts -I=proto_src --ts_out=dist message.proto
, it throws--ts_out: protoc-gen-ts: %1 is not a valid Win32 application.
And it only takes absolute path. Doesn't work with relative path.I have observed that in other typescript generators, there was cmd script given in bin folder of package. But in my npm download, there is only javascript code without any extension to the file but with first line saying '#!/usr/bin/env node'. This made me think if this is made only for shells in unix systems and not windows.
I neither have bazel on my system and nor am I familiar with it. So, I would like to know how to generate files on windows(if it is possible), preferably without bazel.
The text was updated successfully, but these errors were encountered: