dundalek / GrammKit

Generate diagrams for parser grammars
http://dundalek.com/GrammKit/
The Unlicense
236 stars 19 forks source link

Investigate how `parse-ebnf` is included #6

Closed seagreen closed 7 years ago

seagreen commented 7 years ago

I'm trying to package GrammKit up for NixOS using node2nix, and while I can build GrammKit fine, when I try to run the executable I get this error:

[~/code/mine]traveller@nivian $ ./GrammKit/result/bin/grammkit GrammKit/examples/sparql.ebnf 
fs.js:640
  return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
                 ^

Error: ENOENT: no such file or directory, open './lib/parse-ebnf.pegjs'
    at Error (native)
    at Object.fs.openSync (fs.js:640:18)
    at Object.fs.readFileSync (fs.js:508:33)
    at Object.<anonymous> (/nix/store/9srzg40jrjbrsn952j4lc9zcbsn2rxqp-node-grammkit-0.5.0/lib/node_modules/grammkit/cli.js:14:36)
    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)

Is it possible that ./lib/parse-ebnf.pegjs needs to be mentioned somewhere in the package.json file? I think that's what node2nix uses to generate the Nix package.

dundalek commented 7 years ago

Good catch, the file was loaded via relative path. Update to v0.5.1, it should help. If not let me know, there is one more trick left in the sleeve by building the file before npm publish.

seagreen commented 7 years ago

That worked perfect, thanks! 🌟