Reputation: 3972
I'm currently trying to reimplement the todo example app to understand how it works and I'm getting an error when I load the page. I'm not certain how to go from here. What concerns me is the error appears to be in cljs.core
.
todo-app.simulated.services.receive_messages = (function receive_messages(app){
return io.pedestal.app.protocols.put_message.call(null,(new cljs.core.Keyword("\uFDD0:input")).call(null,app),cljs.core.PersistentArrayMap.fromArray([io.pedestal.app.messages.type,"\uFDD0:create-todo",io.pedestal.app.messages.topic,cljs.core.PersistentVector.fromArray(["\uFDD0:todo"], true)], true));
});
The exception message is:
Uncaught TypeError: Object function (meta,cnt,arr,__hash){
this.meta = meta;
this.cnt = cnt;
this.arr = arr;
this.__hash = __hash;
this.cljs$lang$protocol_mask$partition1$ = 4;
this.cljs$lang$protocol_mask$partition0$ = 16123663;
} has no method 'fromArray'
And my dependencies are:
[[org.clojure/clojure "1.5.1"]
[org.clojure/clojurescript "0.0-1820"]
[domina "1.0.1"]
[ch.qos.logback/logback-classic "1.0.7" :exclusions [org.slf4j/slf4j-api]]
[io.pedestal/pedestal.app "0.1.9"]
[io.pedestal/pedestal.app-tools "0.1.9"]]
Any help or insight would be appreciated!
Upvotes: 4
Views: 614
Reputation: 3972
As bostonou suggested, the best approach is deleting the out
directory. My current approach is to use lein-cljsbuild, I personally do this by adding it to my user profile.
You can do so by calling nano ~/.lein/profiles.clj
Mine currently looks like:
{:user {:plugins [[lein-difftest "2.0.0"]
[lein-marginalia "0.7.1"]
[lein-pprint "1.1.1"]
[lein-swank "1.4.4"]
[lein-catnip "0.5.1"]
[environ/environ.lein "0.3.0"]
[lein-cljsbuild "0.3.2"]]
:hooks [environ.leiningen.hooks]}}
You can now automatically build cljs files by calling lein-cljsbuild once
inside the project folder. Calling lein-cljsbuild auto
ensures that when the source files are edited then they are automatically compiled.
I also currently add :hooks [leiningen.cljsbuild]
to my project.clj
so that calling lein clean
will also remove files built by lein-cljsbuild
.
Upvotes: 1
Reputation: 1194
I was seeing this error too, and it seemed like it came out of nowhere. Clearing the out/
dir (:target-path
in your project.clj
) fixed it for me. Based off that, I think there was some disconnect in the cljs compilation process and/or pedestal.
This issue looks similar and the fix was similar, so I assume it's a cljs build problem.
I don't have much to offer regarding pedestal debugging in general, but if I see an error that appears to be in a core library, I start from the assumption that something is wrong on my end. :)
EDIT
A little more info, it's recommended to delete the out\
dir every time you upgrade ClojureScript or Pedestal.
Upvotes: 1