grpc / grpc-node

gRPC for Node.js
https://grpc.io
Apache License 2.0
4.48k stars 647 forks source link

return process.dlopen(module, path.toNamespacedPath(filename));/issues/233 #2781

Closed DharmnathShinde closed 4 months ago

DharmnathShinde commented 4 months ago

Problem description

when I want to generate the .ts file from .proto using command protoc --plugin=protoc-gen-ts_proto="C:/Users/HP/OneDrive/Desktop/grpc/api/node_modules/.bin/protoc-gen-ts_proto.cmd" --ts_proto_out=./src --ts_proto_opt=nestJs=true ./proto/todo.proto then it give an following error.

Reproduction steps

I created proto file also wrote code for it but after entering abhove command it give an error which is as following

Environment

Additional context

Error: Command failed: C:\Users\HP\AppData\Roaming\npm\node_modules\protoc\protoc\bin\protoc.exe --plugin=protoc-gen-ts_proto=C:/Users/HP/OneDrive/Desktop/grpc/api/node_modules/.bin/protoc-gen-ts_proto.cmd --ts_proto_out=./src --ts_proto_opt=nestJs=true ./proto/todo.proto node:internal/modules/cjs/loader:1465 return process.dlopen(module, path.toNamespacedPath(filename)); ^

Error: The specified module could not be found. \?\C:\Users\HP\OneDrive\Desktop\grpc\api\node_modules\dprint-node\dprint-node.win32-x64-msvc.node at Module._extensions..node (node:internal/modules/cjs/loader:1465:18) at Module.load (node:internal/modules/cjs/loader:1206:32) at Module._load (node:internal/modules/cjs/loader:1022:12) at Module.require (node:internal/modules/cjs/loader:1231:19) at require (node:internal/modules/helpers:179:18) at Object. (C:\Users\HP\OneDrive\Desktop\grpc\api\node_modules\dprint-node\index.js:15:18) at Module._compile (node:internal/modules/cjs/loader:1369:14) at Module._extensions..js (node:internal/modules/cjs/loader:1427:10) at Module.load (node:internal/modules/cjs/loader:1206:32) at Module._load (node:internal/modules/cjs/loader:1022:12) { code: 'ERR_DLOPEN_FAILED' }

Node.js v20.12.2 --ts_proto_out: protoc-gen-ts_proto: Plugin failed with status code 1.

at genericNodeError (node:internal/errors:984:15)
at wrappedFn (node:internal/errors:538:14)
at ChildProcess.exithandler (node:child_process:422:12)
at ChildProcess.emit (node:events:518:28)
at maybeClose (node:internal/child_process:1105:16)
at ChildProcess._handle.onexit (node:internal/child_process:305:5) {

code: 1, killed: false, signal: null, cmd: 'C:\Users\HP\AppData\Roaming\npm\node_modules\protoc\protoc\bin\protoc.exe --plugin=protoc-gen-ts_proto=C:/Users/HP/OneDrive/Desktop/grpc/api/node_modules/.bin/protoc-gen-ts_proto.cmd --ts_proto_out=./src --ts_proto_opt=nestJs=true ./proto/todo.proto' } PS C:\Users\HP\OneDrive\Desktop\nextjs\nestjs-grpc> npx protoc --plugin=protoc-gen-ts_proto=$(npx which protoc-gen-ts_proto) --ts_proto_out=./src --ts_proto_opt=nestJs=true ./proto/todo.proto

Error: Command failed: C:\Users\HP\AppData\Roaming\npm\node_modules\protoc\protoc\bin\protoc.exe --plugin=protoc-gen-ts_proto=C:\Users\HP\OneDrive\Desktop\nextjs\nestjs-grpc\node_modules.bin\protoc-gen-ts_proto.CMD --ts_proto_out=./src --ts_proto_opt=nestJs=true ./proto/todo.proto node:internal/modules/cjs/loader:1465 return process.dlopen(module, path.toNamespacedPath(filename)); ^

Error: The specified module could not be found. \?\C:\Users\HP\OneDrive\Desktop\nextjs\nestjs-grpc\node_modules\dprint-node\dprint-node.win32-x64-msvc.node at Module._extensions..node (node:internal/modules/cjs/loader:1465:18) at Module.load (node:internal/modules/cjs/loader:1206:32) at Module._load (node:internal/modules/cjs/loader:1022:12) at Module.require (node:internal/modules/cjs/loader:1231:19) at require (node:internal/modules/helpers:179:18) at Object. (C:\Users\HP\OneDrive\Desktop\nextjs\nestjs-grpc\node_modules\dprint-node\index.js:15:18) at Module._compile (node:internal/modules/cjs/loader:1369:14) at Module._extensions..js (node:internal/modules/cjs/loader:1427:10) at Module.load (node:internal/modules/cjs/loader:1206:32) at Module._load (node:internal/modules/cjs/loader:1022:12) { code: 'ERR_DLOPEN_FAILED' }

Node.js v20.12.2 --ts_proto_out: protoc-gen-ts_proto: Plugin failed with status code 1.

at genericNodeError (node:internal/errors:984:15)
at wrappedFn (node:internal/errors:538:14)
at ChildProcess.exithandler (node:child_process:422:12)
at ChildProcess.emit (node:events:518:28)
at maybeClose (node:internal/child_process:1105:16)
at ChildProcess._handle.onexit (node:internal/child_process:305:5) {

code: 1, killed: false, signal: null, cmd: 'C:\Users\HP\AppData\Roaming\npm\node_modules\protoc\protoc\bin\protoc.exe --plugin=protoc-gen-ts_proto=C:\Users\HP\OneDrive\Desktop\nextjs\nestjs-grpc\node_modules\.bin\protoc-gen-ts_proto.CMD --ts_proto_out=./src --ts_proto_opt=nestJs=true ./proto/todo.proto' }

DharmnathShinde commented 4 months ago

I uninstall the nodejs and again install nodejs problem solved .