I have been in touch with the writer of the modern-cljs tutorial, and he thinks that a library include is missing that used to be a problem, but was fixed. It looks like the problem is back.
You can follow the issue and discussion here: https://github.com/magomimmo/modern-cljs/issues/38 And a huge thank-you to mimmo for looking into this so quickly. On Wednesday, 13 March 2013 13:39:51 UTC+1, Rohan Nicholls wrote: > > Hey all, > > I have been experimenting with clojurescript and following the modern > tutorial. > > However I am now stuck while trying to get the browser repl (brepl) > working. > > I looked on the clojurescript jira tracker and there was no mention of > this problem. There was no way to add an issue, so I thought I would > post here as this is what is mentioned on the clojurescript page. > > This issue means no brepl, which pretty much brings any further > investigation of clojurescript to a halt. > > Thanks in advance for any help. > > Rohan > > The details: > > I was following this tutorial: > https://github.com/magomimmo/modern-cljs/blob/master/doc/tutorial-02.md > > I have a static web server running, I get a repl by executing: > > lein trampoline cljsbuild repl-listen > > And then I go to the simple.html page being served up by my server: > > http://localhost:8888/simple.html > > At this point according to the tutorial I should be good to go, and > the repl from the cljsbuild command given in the terminal earlier > should work. > > However, it hangs, and so I opened the console and saw these errors. > > Uncaught TypeError: Cannot call method 'call' of undefined on line > 989 of repl > > Which is actually caused by: > > Uncaught TypeError: Cannot read property 'client' of undefined on line > 1021 of repl > > The source comes from this url: > > http://localhost:9000/repl?xpc=%7B%22cn%22%3A%22ScD89D6Sbo%22%2C%22tp%22%3Anull%2C%22osh%22%3Anull%2C%22ppu%22%3A%22http%3A%2F%2Flocalhost%3A3000%2Frobots.txt%22%2C%22lpu%22%3A%22http%3A%2F%2Flocalhost%3A9000%2Frobots.txt%22%7D > > > which after some grepping is coming from: > <project root>/repl/client.js > > And sure enough if I go to the offending line I see this: > > </script><script type="text/javascript"> > clojure.browser.repl.client.start("http://localhost:9000"); > Uncaught TypeError: Cannot read property 'client' of undefined > </script></body></html> > > evaluating the clojure object indeed gives us clojure.browser.repl but > the repl object has no client. > > I started looking into this in more depth and found that indeed the > code that defines a client and the start function which is found one > line up: > > clojure.browser.repl.client={}; > clojure.browser.repl.client.start=function(a){ > return goog.events.listen(window,"load",function(){ > return clojure.browser.repl.start_evaluator.call(null,a) > }) > }; > > The ...repl.start_evaluator exists, and looks like this: > > clojure.browser.repl.start_evaluator=function(a){ > var b=clojure.browser.net.xpc_connection.call(null); > if(cljs.core.truth_(b)){ > var c=clojure.browser.net.xhr_connection.call(null); > > clojure.browser.event.listen.call(null,c,"\ufdd0'success",function(a){ > > return > clojure.browser.net.transmit.call(null,b,"\ufdd0'evaluate-javascript",a.currentTarget.getResponseText(cljs.core.List.EMPTY)) > > > }); > > clojure.browser.net.register_service.call(null,b,"\ufdd0'send-result",function(b){ > > > return > clojure.browser.repl.send_result.call(null,c,a,clojure.browser.repl.wrap_message.call(null,"\ufdd0'result",b)) > > > }); > > clojure.browser.net.register_service.call(null,b,"\ufdd0'print",function(b){ > > return > clojure.browser.repl.send_print.call(null,a,clojure.browser.repl.wrap_message.call(null,"\ufdd0'print",b)) > > > }); > > clojure.browser.net.connect.call(null,b,cljs.core.constantly.call(null,null)); > > > return setTimeout(function(){ > return > clojure.browser.repl.send_result.call(null,c,a,clojure.browser.repl.wrap_message.call(null,"\ufdd0'ready","ready")) > > > },50) > } > return alert("No 'xpc' param provided to child iframe.") > } > > > > There is no obvious place where this goes wrong within the > start_evaluator, as all the methods that are called, exist. So here > is the function (prettyfied) where the error occurs. > > Uncaught TypeError: Cannot call method 'call' of undefined on line > 989 of repl > > clojure.browser.net.connect=function(){ > var a=null, > b=function(a){ > var b; > b=a?a.clojure$browser$net$IConnection$connect$arity$1:a; > if(b) > return > a.clojure$browser$net$IConnection$connect$arity$1(a); > b=clojure.browser.net.connect[goog.typeOf(null==a?null:a)]; > > if(!b&&(b=clojure.browser.net.connect._,!b)) > throw > cljs.core.missing_protocol.call(null,"IConnection.connect",a); > return b.call(null,a) > }, > c=function(a,b){ > var c; > c=a?a.clojure$browser$net$IConnection$connect$arity$2:a; > if(c) > return > a.clojure$browser$net$IConnection$connect$arity$2(a,b); > c=clojure.browser.net.connect[goog.typeOf(null==a?null:a)]; > > if(!c&&(c=clojure.browser.net.connect._,!c)) > throw > cljs.core.missing_protocol.call(null,"IConnection.connect",a); > return c.call(null,a,b) > }, > d=function(a,b,c){ > var d; > > d=a?a.clojure$browser$net$IConnection$connect$arity$3:a; > > if(d) > return > a.clojure$browser$net$IConnection$connect$arity$3(a,b,c); > > d=clojure.browser.net.connect[goog.typeOf(null==a?null:a)]; > > if(!d&&(d=clojure.browser.net.connect._,!d)) > throw > cljs.core.missing_protocol.call(null,"IConnection.connect",a); > return d.call(null,a,b,c) > }, > e=function(a,b,c,d){ > var e; > > e=a?a.clojure$browser$net$IConnection$connect$arity$4:a; > > if(e) > return > a.clojure$browser$net$IConnection$connect$arity$4(a,b,c,d); > > e=clojure.browser.net.connect[goog.typeOf(null==a?null:a)]; > > if(!e&&(e=clojure.browser.net.connect._,!e)) > throw > cljs.core.missing_protocol.call(null,"IConnection.connect",a); > return e.call(null,a,b,c,d) > }, > a=function(a,g,h,i){ > switch(arguments.length){ > case 1:return b.call(this,a); > case 2:return c.call(this,a,g); > case 3:return d.call(this,a,g,h); > case 4:return e.call(this,a,g,h,i) > } > throw Error("Invalid arity: "+arguments.length); > }; > a.cljs$lang$arity$1=b; > a.cljs$lang$arity$2=c; > a.cljs$lang$arity$3=d; > a.cljs$lang$arity$4=e; > return a}(); > > I have not managed to walk through this as the debugger considers the > xpc material new every time so breakpoints get discarded on each > refresh. > > > > My project.clj for the modern-cljs project: > > (defproject modern-cljs "0.1.0-SNAPSHOT" > :description "FIXME: write description" > :url "http://example.com/FIXME" > :license {:name "Eclipse Public License" > :url "http://www.eclipse.org/legal/epl-v10.html"} > > ;; clj source code path > :source-paths ["src/clj"] > :dependencies [[org.clojure/clojure "1.5.1"] > [compojure "1.1.5"]] > > ;; lein-cljsbuild plugin to build a cljs project > :plugins [[lein-cljsbuild "0.3.0"] > [lein-ring "0.8.3"]] > > :ring {:handler modern-cljs.core/handler} > > ;; cljsbuild options configuration > :cljsbuild {:builds > [{;; cljs source code path > :source-paths ["src/cljs"] > > ;; google closure (CLS) options configuration > :compiler {;; CLS generated js script filename > :output-to "resources/public/js/modern.js" > > ;; minimal js optimization directive > :whitespace, :simple, :advanced > :optimizations :whitespace > > ;; generated js code prettyfication > :pretty-print true}}]}) > > I tried running it with compojure to see if this solved the problem, > but no luck. > > Chrome version: Version 25.0.1364.155 > Firefox version: 19.0 > > In firefox the lines are the same, but the error messages different: > > [13:32:26.063] TypeError: cljs.core.merge is undefined @ > > http://localhost:9000/repl?xpc=%7B%22cn%22%3A%22VwwA1h4vDD%22%2C%22tp%22%3Anull%2C%22osh%22%3Anull%2C%22ppu%22%3A%22http%3A%2F%2Flocalhost%3A3000%2Frobots.txt%22%2C%22lpu%22%3A%22http%3A%2F%2Flocalhost%3A9000%2Frobots.txt%22%7D:989 > > > [13:32:26.064] TypeError: clojure.browser.repl is undefined @ > > http://localhost:9000/repl?xpc=%7B%22cn%22%3A%22VwwA1h4vDD%22%2C%22tp%22%3Anull%2C%22osh%22%3Anull%2C%22ppu%22%3A%22http%3A%2F%2Flocalhost%3A3000%2Frobots.txt%22%2C%22lpu%22%3A%22http%3A%2F%2Flocalhost%3A9000%2Frobots.txt%22%7D:1021 > > > And that is where I am going to leave it, as someone will probably > take one look and know what is wrong, while I am flailing around in > the dark. > -- -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.