ClojureDart: Execution error at cljd.compiler/load-libs-info (compiler.cljc:126). EOF while reading

Viewed 48

While translating a flutter cookbook into ClojureDart, I encoutered this error. I initialized the project that way:

$ mkdir -p src/samples && touch src/samples/tabs.cljd
$ clj -M -m cljd.build init --dart samples.tabs

And then I compiled it this way:

$ clj -M -m cljd.build flutter

What did I do wrong ?

1 Answers

My .clojuredart/libs-info.edn file was empty, that is why it causes EOF. The mistake here is not from the code itself, but from the way I initialized the project. Instead of doing:

$ clj -M -m cljd.build init --dart samples.tabs

I should have just done:

$ clj -M -m cljd.build init samples.tabs

without the --dart.

There are two ways to correct this.

  1. Start again with the correct command
  2. redirect the output of the analyzer into libs-info.edn. If you run ls into .clojuredart, you will notice that there are two files: analyzer.dart and libs-info.edn. ClojureDart uses the analyzer to product dart code. run:
$ dart .clojuredart/analyzer.dart > .clojuredart/libs-info.edn

And it should works, just like it did for me !

Related