Closed nbetcher closed 6 years ago
Hello @nbetcher,
I encountered the same issue. I tried to solve this issue but anything works. Can you show me your fix ?
Thank you ;)
Ok, figured it out. First i ran the pkg with debug with a grep '/castv2/lib' and could see only certain files in the lib folder being added.
pkg index.js --out-put out --debug | grep castv2/lib
To fix you need to use path.join instead of __dirname + '/cast_channel.proto'
.
var builder = ProtoBuf.loadProtoFile(path.join(__dirname, "/cast_channel.proto"));
You also need to include path
var path = require('path');
Not sure how to do a pull request, if someone could to fix this instead of manually editing would be awesome.
I haven't done a pull request in a long time, but if you're determined enough to fix the problem then a pull request is easy. ;-)
Hello, When using 'pkg' to package an application together into a static executable, the castv2 library is throwing this error upon execution of said static executable:
Which boils down to these two lines:
Now I'm a total NodeJS noob and I really have no idea how 'pkg' works (e.g. if it virtualizes a file system, or how exactly), but operating on the theory that it can't "read" that file since it's all one static package, I simplified the contents of cast_channel.proto (e.g. removed new lines, comments, etc), put the contents into a variable, and used loadProto (which accepts a string instead of file contents). This method worked once packaged into a static executable.
If you consider this a defect with pkg, please let me know, but a workaround for others is probably nice too. :-)