protobuf.js
protobuf.js copied to clipboard
7.2.5 to 7.4.0 pbjs cross directory generation error
The directory structure is as follows proto/dir1/a.proto proto/dir2/b.proto
Among them, a. proto import "dir2/b.proto"
Generate errors through PBJS Error: ENOENT: no such file or directory, open 'proto/dir1/dir2/b.proto'
Generate command: pbjs --verbose --root proto -t static-module -w es6 proto/**/*.proto -o proto/proto.js
Ps. It is normal and successful for these proto files to generate golang using protoc.
at Object.openSync (node:fs:562:18)
at Object.readFileSync (node:fs:446:35)
at fetch (/Volumes/FireTiger/MFKSoft/Web/node_modules/.pnpm/[email protected]/node_modules/protobufjs/src/root.js:173:34)
at process (/Volumes/FireTiger/MFKSoft/Web/node_modules/.pnpm/[email protected]/node_modules/protobufjs/src/root.js:133:29)
at fetch (/Volumes/FireTiger/MFKSoft/Web/node_modules/.pnpm/[email protected]/node_modules/protobufjs/src/root.js:179:13)
at Root.load (/Volumes/FireTiger/MFKSoft/Web/node_modules/.pnpm/[email protected]/node_modules/protobufjs/src/root.js:207:13)
at Root.loadSync (/Volumes/FireTiger/MFKSoft/Web/node_modules/.pnpm/[email protected]/node_modules/protobufjs/src/root.js:248:17)
at Object.main (/Volumes/FireTiger/MFKSoft/Web/node_modules/.pnpm/[email protected][email protected]/node_modules/protobufjs-cli/pbjs.js:247:18)
at Object.<anonymous> (/Volumes/FireTiger/MFKSoft/Web/node_modules/.pnpm/[email protected][email protected]/node_modules/protobufjs-cli/bin/pbjs:4:16)
at Module._compile (node:internal/modules/cjs/loader:1546:14) {
errno: -2, code: 'ENOENT', syscall: 'open',