Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

$protobuf.Root is not a constructor #860

Closed
sang4lv opened this issue Jul 11, 2017 · 3 comments
Closed

$protobuf.Root is not a constructor #860

sang4lv opened this issue Jul 11, 2017 · 3 comments

Comments

@sang4lv
Copy link

sang4lv commented Jul 11, 2017

protobuf.js version: 6.8.0

Executing ./node_modules/protobufjs/bin/pbjs --keep-case -t json-module -w commonjs -o pb.node.js api.proto generates a pb.node.js file that uses protobufjs/minimal package. However, this causes the following error

TypeError: $protobuf.Root is not a constructor
    at Object.<anonymous> (/Users/angelawang/Projects/common-proto/pb.node.js:6:74)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/Users/angelawang/Projects/common-proto/test/index.js:2:14)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at /usr/local/lib/node_modules/mocha/lib/mocha.js:219:27
    at Array.forEach (native)
    at Mocha.loadFiles (/usr/local/lib/node_modules/mocha/lib/mocha.js:216:14)
    at Mocha.run (/usr/local/lib/node_modules/mocha/lib/mocha.js:468:10)
    at Object.<anonymous> (/usr/local/lib/node_modules/mocha/bin/_mocha:403:18)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.runMain (module.js:604:10)
    at run (bootstrap_node.js:390:7)
    at startup (bootstrap_node.js:150:9)
    at bootstrap_node.js:505:3

If I changed the package to use "protobufjs/light" or "protobufjs", the error goes away

@eventualbuddha
Copy link
Contributor

Probably a duplicate of #828, and probably caused by #813. I was going to create a PR to fix this but I can't find the tests for codegen. Based on the changes made in #813 I'm starting to think there aren't any 😢

@dcodeIO?

@dcodeIO
Copy link
Member

dcodeIO commented Jul 11, 2017

Yes, this is due to a wrong dependency on the minimal library as described in the issues linked by eventualbuddha. There are no specific CLI tests currently, apart from that the CLI is run programmatically to generate part of the tests.

@dcodeIO
Copy link
Member

dcodeIO commented Jul 11, 2017

Should be fixed by #864

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants