martinklepsch / tenzing

⚡️ Clojurescript application template using Boot
Eclipse Public License 1.0
403 stars 39 forks source link

Cannot get cljs repl working #42

Closed lgastako closed 8 years ago

lgastako commented 9 years ago

I created a new project with lein new tenzing repltest +om +sass +test and then tried to start a cljs repl (without changing anything in the project) and I get this:

% boot repl
nREPL server started on port 65366 on host 127.0.0.1 - nrepl://127.0.0.1:65366
REPL-y 0.3.5, nREPL 0.2.8
Clojure 1.7.0
Java HotSpot(TM) 64-Bit Server VM 1.8.0_20-b26
        Exit: Control+D or (exit) or (quit)
    Commands: (user/help)
        Docs: (doc function-name-here)
              (find-doc "part-of-name-here")
Find by Name: (find-name "part-of-name-here")
      Source: (source function-name-here)
     Javadoc: (javadoc java-object-or-class-here)
    Examples from clojuredocs.org: [clojuredocs or cdoc]
              (user/clojuredocs name-here)
              (user/clojuredocs "ns-here" "name-here")
boot.user=> (start-repl)

java.io.FileNotFoundException: Could not locate cemerick/piggieback__init.class or cemerick/piggieback.clj on classpath.
boot.user=>

So I added an explicit dependency on the latest version of piggieback:

[com.cemerick/piggieback "0.2.1" :scope "test"]

which led to:

boot.user=> (start-repl)

java.io.FileNotFoundException: Could not locate weasel/repl/websocket__init.class or weasel/repl/websocket.clj on classpath.

so I added an explicit dependency for weasel:

[weasel "0.7.0" :scope "test"]

which gets me to this:

boot.user=> (start-repl)

java.lang.NullPointerException:
boot.user=>

(no other output)

and I'm not quite sure where to go from there. Any advice would be appreciated.

Operating system is OS X for what it's worth.

crisptrutski commented 9 years ago

Hi John!

The issue here is the way you're launching the repl -

To just parrot from the README quickly, the recommended workflow is:

  1. boot dev to start all-in-one nrepl and web server
  2. boot repl -c once that is ready, to connect the the nrepl server (or connect via your editor)
  3. (start-repl) aka cha-ching

In your case, simply running boot repl results in incomplete dependencies (as your adventure chasing piggieback et al demonstrated). The boot-cljs-repl task actually takes care of setting up the correct environment, or warning if something is awry. But then you'd still need to compile the Clojurescript files, so that the browser can run them to connect to Weasel (enter boot-cljs), and then you might as well serve those static files (so bring in boot-http).

Thus you arrive at the boot dev task :)

(This slightly undersells boot dev, it also provides code-push-on-changes to that browser and that sass compilation you ordered)