Skip to content
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

Can't get it working #13

Closed
Daniel15 opened this issue Oct 20, 2019 · 6 comments · Fixed by #16
Closed

Can't get it working #13

Daniel15 opened this issue Oct 20, 2019 · 6 comments · Fixed by #16

Comments

@Daniel15
Copy link
Contributor

I'm trying to see if this project will generate TypeScript definitions for my Protobuf types (sounds like it will). However, I can't seem to get it working. I tried a command similar to the one in the readme, which gave me:

c:\apps\protobuf\bin\protoc --plugin=./node_modules/.bin/protoc-gen-ts_proto --ts_proto_out=./src/generated --proto_path=../../Proto ../../Proto/dnstools.proto

--ts_proto_out: protoc-gen-ts_proto: %1 is not a valid Win32 application.

After reading protocolbuffers/protobuf#3923, I tried protoc-gen-ts_proto.cmd as the plugin path, which gave me a different error:

c:\apps\protobuf\bin\protoc --plugin=./node_modules/.bin/protoc-gen-ts_proto.cmd --ts_proto_out=./src/generated --proto_path=../../Proto ../../Proto/dnstools.proto
'protoc-gen-ts_proto' is not recognized as an internal or external command,
operable program or batch file.
--ts_proto_out: protoc-gen-ts_proto: Plugin failed with status code 1.

Any ideas?

@Daniel15
Copy link
Contributor Author

This worked for me:

c:\apps\protobuf\bin\protoc --plugin=protoc-gen-ts_proto=.\node_modules\.bin\protoc-gen-ts_proto.cmd --ts_proto_out=./src/generated --proto_path=../../Proto ../../Proto/dnstools.proto

I had to prefix the plugin path with protoc-gen-ts_proto=, and use \ instead of / in the path.

Should I submit a PR for the readme?

@stephenh
Copy link
Owner

Huh, I hadn't seen the --plugin=...plugin...=path syntax before, wonder why it was working for me without that. Either way, that looks more canonical, so sure, a readme PR sounds great. Thanks!

@stephenh
Copy link
Owner

Thanks @Daniel15 !

@SySagar
Copy link

SySagar commented Aug 21, 2023

I was making auth system in the same folder as the proto file is.
For me it worked something like this:

protoc --plugin=protoc-gen-ts_proto=.\node_modules\.bin\protoc-gen-ts_proto.cmd --ts_proto_out=./ --ts_proto_opt=nestJs=true ./proto/auth.proto

@arifMediaNv
Copy link

I was making auth system in the same folder as the proto file is. For me it worked something like this:

protoc --plugin=protoc-gen-ts_proto=.\node_modules\.bin\protoc-gen-ts_proto.cmd --ts_proto_out=./ --ts_proto_opt=nestJs=true ./proto/auth.proto

thank you also worked for me

@edgaremirborbonjimenez
Copy link

edgaremirborbonjimenez commented Apr 5, 2024

I was making auth system in the same folder as the proto file is. For me it worked something like this:

protoc --plugin=protoc-gen-ts_proto=.\node_modules\.bin\protoc-gen-ts_proto.cmd --ts_proto_out=./ --ts_proto_opt=nestJs=true ./proto/auth.proto

I have been trying to do that with a personal project it´s only the gateway im not doing the microservice, but the terminal returns me this:

this is what I put in the terminal:

protoc --plugin=protoc-gen-ts_proto=.\node_modules.bin\protoc-gen-ts_proto.cmd --ts_proto_out=./ --ts_proto_opt=nestJs=true ./proto/product.proto

and this is the response:
--ts_proto_out: protoc-gen-ts_proto: The system cannot find the file specified.

And it says that may be doesn´t can find the protoc-gen-ts_proto file, but if I look for the protoc-gen-ts-proto file i found it in ./node_modules/bin/protoc-gen-ts_proto.cmd

I also tried adding --proto_path, but says the same problem

$ protoc --plugin=protoc-gen-ts_proto=.\node_modules.bin\protoc-gen-ts_proto.cmd --ts_proto_out=./ --ts_proto_opt=nestJs=true --proto_path=./proto ./proto/product.proto

--ts_proto_out: protoc-gen-ts_proto: The system cannot find the file specified.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants