Registry / devops / grpc-vuex

grpc-vuex

JSON →
library0.21.0jsnpmunverified

A command-line code generator that produces JavaScript (Vuex) store modules and TypeScript definitions from gRPC-Web proto files. Stable version 0.21.0, low release cadence (last update 2020). Key differentiator: integrates gRPC-Web with Vuex state management, generating Vuex actions and mutations automatically. Requires external protoc and protoc-gen-grpc-web tools. Limited to unary RPCs; streaming not supported.

npm install grpc-vuex
INSTALL
IMPORT
SIG · GRPC-VUEX
G
grpc-vuex
devopsjavascriptv0.21.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.

sayHello (generated function)
import { sayHello } from './output'
import sayHello from './output'
Generated functions are named exports, not default exports.
TypeScript interfaces (e.g., User, HelloRequest)
import type { User, HelloRequest } from './output'
import { User } from './output'
Interfaces are only available in .d.ts; import them as types.
CommonJS require
const { sayHello } = require('./output')
const sayHello = require('./output')
Generated module uses named exports; destructuring required.

Shows global installation, code generation command, and usage of a generated unary RPC function in a Vuex context.

// Install globally npm i -g grpc-vuex # Note: protoc and protoc-gen-grpc-web must be in PATH # Generate code from a proto file # grpc-vuex <output_file_path> <proto_file_paths ...> grpc-vuex generated.js my-service.proto --endpoint https://api.example.com // In your Vuex store import { sayHello } from './generated'; sayHello({ users: [{ name: 'Alice', age: 30, children: ['Bob'] }] }) .then((res) => console.log(res)) .catch((err) => console.error(err));
Debug
Known issues
gotchaRequires protoc and protoc-gen-grpc-web to be installed and in PATH. Without them, generation fails silently.
fix
Install protoc from https://github.com/protocolbuffers/protobuf/releases and protoc-gen-grpc-web from https://github.com/grpc/grpc-web/releases.
affects: >=0.0.0
breakingNo support for streaming RPCs (server-streaming, client-streaming, bidirectional). Only unary calls are generated.
fix
Use a different gRPC-Web client library if streaming is needed.
affects: >=0.0.0
deprecatedPackage last updated in 2020. May not work with newer versions of Vuex (3.x/4.x), protoc, or gRPC-Web.
fix
Consider using @grpc/grpc-js or grpc-web directly with custom Vuex integration.
affects: >=0.0.0
gotchaThe generated code uses CommonJS module format; ESM import requires a bundler or Node.js with ESM support.
fix
Use a bundler (Webpack, Rollup) or convert the generated file to ESM manually.
affects: >=0.0.0
gotchaThe --endpoint flag must be provided; otherwise, the generated code will have an undefined endpoint.
fix
Always include --endpoint with a valid URL.
affects: >=0.0.0
Errors
Common errors & fixes
Error: Cannot find module 'protoc-gen-grpc-web'
protoc-gen-grpc-web is not installed or not in PATH.
fix
Install via npm: npm install -g protoc-gen-grpc-web, or add its location to PATH.
Error: Command failed: protoc --version
protoc is not installed or not in PATH.
fix
Install Protocol Buffers compiler (protoc) from https://github.com/protocolbuffers/protobuf/releases and ensure it is in PATH.
TypeError: Cannot read property 'prototype' of undefined
The generated code expects a Vuex store instance, but none was provided or the import path is wrong.
fix
Ensure the generated file is imported correctly after store creation, and that you are using Vuex 3.x (not 4.x).
TypeError: grpc_vuex is not a function
Trying to import grpc-vuex as a runtime library instead of using its CLI.
fix
grpc-vuex is a CLI code generator, not a runtime library. Run `npx grpc-vuex` to generate code, then import the generated file.
Upgrade
Version history
0.21.0latest on npm
Audit
Dependencies
protocrequiredProtocol Buffers compiler, required at generation time
protoc-gen-grpc-webrequiredgRPC-Web code generator plugin, required at generation time
Agent activity
18 hits · last 30 days
node
16
OpenAI (training)
1
Resources
grpc-vuex — npm install grpc-vuex · libregistry