Open
Description
protobuf.js version: [email protected]
I tried generating a .js
and .d.ts
file using pbjs
and pbts
, but on node 12.0, pbts
fails. Earlier versions of node work.
Node 12.0.0:
$ cat proto3.proto
syntax = "proto3";
message SearchRequest {
string query = 1;
int32 page_number = 2;
int32 result_per_page = 3;
}
$ npx pbjs -t static-module -w commonjs -o compiled.js proto2.proto
$ npx pbts -o compiled.d.ts compiled.js
/tmp/test/node_modules/protobufjs/cli/node_modules/requizzle/lib/requizzle.js:45
if (lookupPaths[0] === targetPath && lookupPaths[1].length === 0) {
^
TypeError: Cannot read property '0' of null
at isNativeModule (/tmp/test/node_modules/protobufjs/cli/node_modules/requizzle/lib/requizzle.js:45:17)
at Requizzle.requizzle (/tmp/test/node_modules/protobufjs/cli/node_modules/requizzle/lib/requizzle.js:82:6)
at infectProxy (/tmp/test/node_modules/protobufjs/cli/node_modules/requizzle/lib/loader.js:82:28)
at Module.targetModule.require (/tmp/test/node_modules/protobufjs/cli/node_modules/requizzle/lib/loader.js:101:11)
at require (internal/modules/cjs/helpers.js:16:16)
at Object.<anonymous> (/tmp/test/node_modules/protobufjs/cli/node_modules/jsdoc/lib/jsdoc/fs.js:7:10)
at Module._compile (internal/modules/cjs/loader.js:759:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:770:10)
at Module.load (internal/modules/cjs/loader.js:628:32)
at Object.load (/tmp/test/node_modules/protobufjs/cli/node_modules/requizzle/lib/loader.js:112:15)
/tmp/test/node_modules/protobufjs/cli/pbts.js:133
throw err;
^
Error: code 1
at ChildProcess.<anonymous> (/tmp/test/node_modules/protobufjs/cli/pbts.js:130:27)
at ChildProcess.emit (events.js:201:15)
at maybeClose (internal/child_process.js:1000:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:267:5)
$ node --version
v12.0.0
$ npm list
/tmp/test
└─┬ [email protected]
├── @protobufjs/[email protected]
├── @protobufjs/[email protected]
├── @protobufjs/[email protected]
├── @protobufjs/[email protected]
├─┬ @protobufjs/[email protected]
│ ├── @protobufjs/[email protected] deduped
│ └── @protobufjs/[email protected] deduped
├── @protobufjs/[email protected]
├── @protobufjs/[email protected]
├── @protobufjs/[email protected]
├── @protobufjs/[email protected]
├── @protobufjs/[email protected]
├── @types/[email protected]
├── @types/[email protected]
└── [email protected]
Node 11.0.0:
$ nvm use 11.0
Now using node v11.0.0 (npm v6.4.1)
$ node --version
v11.0.0
$ npx pbjs -t static-module -w commonjs -o compiled.js proto2.proto
$ npx pbts -o compiled.d.ts compiled.js
I tried with a simple proto3 file and it has the same behaviour.