Registry / devops / grpc-plugins

grpc-plugins

JSON →
library0.0.4jsnpmunverified

Provides OSX binaries for common gRPC protoc compiler plugins needed to generate gRPC client/server code for Node.js (JavaScript/TypeScript), Swift, Java (Android) and Java lite. Current version 0.0.4 includes protoc v3.6.0, grpc_node_plugin v1.6.6, protoc-gen-grpc-java v1.13.1, protoc-gen-swiftgrpc v0.4.3, and protoc-gen-ts. Only OSX binaries are available; contributions for Linux/Windows are welcome. This package simplifies setup by bundling all plugins in one dependency, but note the binaries are outdated and the package has not been updated since 2018.

npm install grpc-plugins
INSTALL
IMPORT
SIG · GRPC-PLUGINS
G
grpc-plugins
devopsjavascriptv0.0.4
harness data pending
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.

path
const BINPATH = path.join(__dirname, 'node_modules', 'grpc-plugins', 'osx')
const BINPATH = './node_modules/grpc-plugins/osx'
Use path module for cross-platform compatibility. The binaries are only available for OSX.
require
const grpc = require('@grpc/grpc-js')
const grpc = require('grpc')
'grpc' package is deprecated; use '@grpc/grpc-js' for Node.js gRPC implementation.
proto-loader
const protoLoader = require('@grpc/proto-loader')
const protoLoader = require('grpc-tools')
Use '@grpc/proto-loader' to load .proto files dynamically at runtime.

Demonstrates running protoc with grpc_node_plugin to generate gRPC stubs for Node.js.

// Install: yarn add --dev grpc-plugins // Then use the shell script from the README to generate code. // Note: Only works on OSX. Binaries are outdated. const path = require('path'); const { execSync } = require('child_process'); const binPath = path.resolve('node_modules/grpc-plugins/osx'); const protoDir = path.resolve('proto'); const outDir = path.resolve('generated'); // Generate Node.js code execSync(`${binPath}/protoc \ --js_out=import_style=commonjs,binary:${outDir} \ --grpc_out=${outDir} \ --plugin=protoc-gen-grpc=${binPath}/grpc_node_plugin \ -I ${protoDir} \ ${protoDir}/*.proto`, { stdio: 'inherit' });
Debug
Known issues
deprecatedPackage not maintained since 2018. Binaries for protoc, grpc_node_plugin, and others are outdated.
fix
Use latest versions from official sources: https://github.com/protocolbuffers/protobuf/releases, https://www.npmjs.com/package/grpc-tools
affects: >=0.0.1
gotchaOnly OSX binaries provided. Using on Linux or Windows will fail with missing binaries.
fix
Install native binaries for your platform manually or use package like 'protoc' and 'grpc-tools'.
affects: <=0.0.4
deprecatedThe 'grpc' npm package is deprecated. Generated code expects 'grpc' but '@grpc/grpc-js' is recommended.
fix
Use '@grpc/grpc-js' package and update generated code accordingly.
affects: >=0.0.1
breakingVersion 0.0.4 bundles protoc v3.6.0, which may not be compatible with newer .proto syntax or options.
fix
Download latest protoc from https://github.com/protocolbuffers/protobuf/releases
affects: 0.0.4
gotchaThe package includes binaries as git-lfs or platform-specific files; ensure they are correctly downloaded on install.
fix
Verify binary file exists in node_modules/grpc-plugins/osx after install.
affects: >=0.0.1
Errors
Common errors & fixes
Error: Cannot find module 'grpc'
Generated code imports 'grpc' package which is not installed or is deprecated.
fix
npm install @grpc/grpc-js and replace imports from 'grpc' to '@grpc/grpc-js'
protoc: error while loading shared libraries: libprotoc.so.xx: cannot open shared object file
Missing protobuf runtime libraries on Linux when using OSX binary via Wine or similar.
fix
Use native Linux binaries; this package only supports OSX.
grpc_node_plugin: command not found
Binary not executable or not found in PATH.
fix
Check that binPath is correct and run chmod +x on the plugin file.
Upgrade
Version history
0.0.4latest on npm
Audit
Dependencies
grpcrequiredRequired at runtime for Node.js gRPC client/server. The generated code uses '@grpc/grpc-js' recommended instead.
grpc-toolsoptionalAlternative source for grpc_node_plugin; this package bundles the same binary.
protocoptionalThe protoc compiler required to run the plugins. Bundled here for OSX.
Agent activity
8 hits · last 30 days
node
8
Resources
grpc-plugins — npm install grpc-plugins · libregistry