capnproto / node-capnp

Cap'n Proto bindings for Node.js
BSD 2-Clause "Simplified" License
258 stars 35 forks source link

Module.js throws error on trying to load the .capnp file #34

Open Pooja71 opened 7 years ago

Pooja71 commented 7 years ago

The following line

var foo = require("./foo.capnp");

throws an Exception/: unexpected Symbol as the first line is the schema ID 0x..... Am I calling the schema in a wrong way?

Environment Used node: 6.11.2

kentonv commented 7 years ago

Hi Pooja,

Can you provide a more complete test case? Please show us the whole Javascript file and the whole .capnp file, and how you're invoking it on the command line.

It's hard to say what the problem could be without all the info, but here's one possibility: You have to call require("capnp") before you can require a .capnp file.