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

"--js_out: options: mode is required" error on code generation #1251

Closed
metapone opened this issue Jun 1, 2022 · 4 comments · Fixed by #1263
Closed

"--js_out: options: mode is required" error on code generation #1251

metapone opened this issue Jun 1, 2022 · 4 comments · Fixed by #1263
Labels

Comments

@metapone
Copy link

metapone commented Jun 1, 2022

Using protoc v21.0 with grpc-web v1.3.1 will yield error "--js_out: options: mode is required". Downgrading to protoc v3.20.1 will temporarily solve this issue.

Here's my full protoc command:
protoc -I=./ Protos/test.proto --js_out=import_style=commonjs:. --grpc-web_out=import_style=typescript,mode=grpcwebtext:.

@sampajano
Copy link
Collaborator

Thanks so much for bringing this up! Will check and get back! Thanks! :)

@sampajano
Copy link
Collaborator

sampajano commented Jun 2, 2022

Found out more details :) This is actually an intentional change, as announced here:
https://developers.google.com/protocol-buffers/docs/news/2022-05-06#javascript

A new protoc binary will be provided separately at https://github.com/protocolbuffers/protobuf-javascript to provide --js_out functionalities. It's not ready yet and i will update this thread when it is..

For now, please use the v3.20.1 (link) release of the protoc binary..

Thanks for your understanding! :)

@sampajano
Copy link
Collaborator

A new separate JS compiler is now provided by protobuf-javascript:
https://github.com/protocolbuffers/protobuf-javascript/releases

I'll update the documentations to point to it instead :)

@guptaaashutosh
Copy link

You need to install protoc-gen-js globally to generate gRPC code in javascript using bellow command
npm install -g protoc-gen-js

Then, bellow command to generate gRPC code
protoc --js_out=import_style=commonjs,binary:. your_proto_file_name.proto

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

Successfully merging a pull request may close this issue.

3 participants