Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
gen-grpc
✓ npx gen-grpc ./proto ./src/grpc
✗ gen-grpc ./proto ./src/grpc (without npx if globally installed, but local install requires npx or script)
CLI command, not imported in code. Run via npx or npm script.
gen-grpc-web
✓ npx gen-grpc-web ./proto ./src/grpc --only-types
✗ Short option forms like -o for --only-types are not supported; use full option names.
CLI command for gRPC-Web clients. --only-types omits binary methods.
GrpcWebImpl
✓ import { GrpcWebImpl } from './path/to/generated/grpc/example'
✗ Import from 'quick-ts-proto' (it's a CLI tool, not a library)
Generated file path depends on output directory and proto file name.
ExampleGrpcServiceClientImpl
✓ import { ExampleGrpcServiceClientImpl } from './path/to/generated/grpc/example'
✗ import { ExampleGrpcServiceClient } from './example' (missing Impl suffix)
Generated client class name is constructed from the service name + 'ClientImpl'.
Demonstrates generating gRPC-Web client code from proto files and using the generated client with RxJS subscriptions.
// Install quick-ts-proto as dev dependency
npm install quick-ts-proto --save-dev
# Generate gRPC-Web client code
npx gen-grpc-web ./proto ./src/grpc --only-types
# Use the generated client in your app
import { GrpcWebImpl, ExampleGrpcServiceClientImpl } from './src/grpc/example';
const rpc = new GrpcWebImpl('http://localhost:9090', { debug: true });
const client = new ExampleGrpcServiceClientImpl(rpc);
// Subscribe to streaming calls
client.SubscribeUserInfoChanged({}).subscribe({
next: (response) => console.log(response.message),
error: (err) => console.error(err),
});
Errors
Common errors & fixes
Cannot find module 'protobufjs'
Missing runtime dependency protobufjs. The generated code requires it for encoding/decoding.
fixInstall protobufjs: npm install protobufjs
Error: no such option: --only-types (or -o recognized but not handled)
CLI only supports long-form options (--only-types), not short form (-o).
fixUse --only-types instead of -o.
Error: Cannot find module '@improbable-eng/grpc-web'
Missing gRPC-Web transport dependency.
fixInstall @improbable-eng/grpc-web: npm install @improbable-eng/grpc-web
TypeError: exampleClient.SubscribeUserInfoChanged is not a function
Generated client expects the gRPC-Web transport (GrpcWebImpl) to be passed in the constructor. If not properly instantiated, methods are undefined.
fixEnsure you create GrpcWebImpl with the correct endpoint and pass it to the client constructor: new ExampleGrpcServiceClientImpl(rpc)
Audit
Dependencies
protobufjsrequiredRequired for both gRPC and gRPC-Web code generation as a peer dependency for encoding/decoding.
@grpc/grpc-jsoptionalRequired for gRPC server/client code generation.
rxjsoptionalRequired for client-side gRPC-Web streaming support.
longoptionalRequired for handling 64-bit integers in protobuf-Web generated code.
browser-headersoptionalRequired for gRPC-Web metadata handling.
@improbable-eng/grpc-weboptionalRequired for gRPC-Web transport layer.