grpc_tools_node_protoc_ts
grpc_tools_node_protoc_ts copied to clipboard
Hit `<foo>_pb.js` does not provide an export named `'<foo>'` syntax error
I generate proto js files with:
npx grpc_tools_node_protoc --js_out=import_style=commonjs,binary:./grpc/client --grpc_out=grpc_js:./grpc/client --plugin=protoc-gen-grpc=`which grpc_tools_node_protoc_plugin` -I ./grpc/proto ./grpc/proto/*.proto && npx protoc --plugin=protoc-gen-ts=`which protoc-gen-ts` --ts_out=grpc_js:./grpc/client -I ./grpc/proto ./grpc/proto/*.proto
These are the generated artefacts:
I don't see any error when building the typescript project. However, when I run I hit this error:
$ export PORT=4433&&n run start
> [email protected] start
> export NODE_ENV=development&& node --experimental-specifier-resolution=node build/src/webapi/server.js
file:///usr/src/Node.JSRestAPI/build/src/webapi/Services/SchoolService.js:5
import { CommonStudentsResponse as grpcCommonStudentsResponse, } from "../grpc/client/school_pb.js";
^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: The requested module '../grpc/client/school_pb.js' does not provide an export named 'CommonStudentsResponse'
at ModuleJob._instantiate (node:internal/modules/esm/module_job:171:21)
at async ModuleJob.run (node:internal/modules/esm/module_job:254:5)
at async ModuleLoader.import (node:internal/modules/esm/loader:475:24)
at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:109:5)
Node.js v22.2.0
I see the symbol being defined in the file in question:
What do I miss?
Environment
- OS name, version and architecture: [e.g. Linux Ubuntu 18.04 amd64] Ubuntu 24.04
- Node version [e.g. 8.10.0] 22.4.1
- Node installation method [e.g. nvm]
apt - If applicable, compiler version [e.g. clang 3.8.0-2ubuntu4] g++ 13.2.0
- Package name and version [e.g. [email protected]]:
"grpc_tools_node_protoc_ts": "^5.3.3",
"@grpc/grpc-js": "^1.10.10",
"@grpc/proto-loader": "^0.7.13",