Registry / devops / protoc-bin

protoc-bin

JSON →
library3.10.0jsnpmunverified

Simple npm wrapper that downloads and runs Google's Protocol Buffers compiler (protoc) for the current operating system. This package mirrors protoc version numbers (currently 3.10.0) but updates are lagging behind official releases. Use it when you need a quick protoc binary via npm without manual installation. For reliable and up-to-date protoc binaries, consider using protobuf-compiler or downloading from GitHub releases.

npm install protoc-bin
INSTALL
IMPORT
SIG · PROTOC-BIN
P
protoc-bin
devopsjavascriptv3.10.0
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.

default export
import protocBin from 'protoc-bin';
const { default } = require('protoc-bin');
The package exports a path or binary. Importing the default gives you the binary path. In CommonJS, use const protocBin = require('protoc-bin').default or require('protoc-bin') if configured correctly.
path
import { path } from 'protoc-bin';
import path from 'protoc-bin';
Named export 'path' gives the path to the downloaded protoc binary. For ESM, use named import. For CJS: const { path } = require('protoc-bin');
bin()
import protocBin from 'protoc-bin'; const protoc = protocBin.bin();
const protoc = protocBin();
The default export is an object with a `bin()` method that returns the binary path. Do not invoke the default export directly.

Shows how to import protoc-bin, get the binary path, and run protoc --version.

import protocBin from 'protoc-bin'; import { execFileSync } from 'child_process'; const protocPath = protocBin.bin(); const result = execFileSync(protocPath, ['--version']).toString(); console.log(result);
Debug
Known issues
gotchaThe package downloads binaries on first use; requires network access and may be slow.
fix
Ensure network connectivity on first run or pre-cache the binary in CI.
affects: >=0.0.0
deprecatedprotoc-bin versions lag behind official protoc releases. The latest npm version is 3.10.0, while official protoc is at 29.x.
fix
Consider using a more actively maintained package like protobuf-compiler or download protoc directly from GitHub.
affects: <=3.10.0
gotchaPlatform-specific binaries may have different paths; the package only supports x64 Linux, macOS, and Windows.
fix
Check that your OS/architecture is supported. For unsupported systems, use protoc directly.
affects: >=0.0.0
Errors
Common errors & fixes
Error: end of central directory record signature not found
Corrupted or incomplete binary download due to network issues.
fix
Delete the cache directory (usually in node_modules/.cache/bin-wrapper) and reinstall the package.
Error: No binary found for your operating system and architecture
The package does not have a pre-built binary for your OS/arch (e.g., ARM Linux).
fix
Use an alternative method to obtain protoc, such as downloading from the official protobuf releases.
Error: EACCES: permission denied, unlink '/path/to/protoc'
Permission issues when downloading or caching the binary, often in CI environments.
fix
Run the install command with sufficient permissions or set a custom cache directory with write access.
Upgrade
Version history
3.10.0latest on npm
Audit
Dependencies
bin-wrapperrequireddownloads and caches platform-specific protoc binary
Agent activity
4 hits · last 30 days
node
4
Resources
protoc-bin — npm install protoc-bin · libregistry