I have a fresh luminus app with lein new luminus repltest +re-frame
. When I run the repl via emacs I end up with a prompt that doesn’t respond to anything. If I navigate my browser to localhost:3449, I see a message stating “Figwheel Server: Resource not found”
Maybe! It’s unclear to me whether the template hasn’t been updated yet or whether it’s a deliberate design decision to stick with the older version for reasons such as reliability or configuration or who knows what. Shadow is popular, true, but for me the primary reason I was interested in using it was for easier npm dependency integration, but recent developments in cljs have made it easier to do this without shadow https://clojurescript.org/news/2020-04-24-bundle-target
I’ve found that I can connect to the repl from emacs by first running lein shadow watch app
and in another tab lein run
at the terminal, then switching to emacs and running cider-connect-clj
followed by specifying the localhost and port 7002 to cider prompts, then calling (shadow/repl :app)
from repl
I thought cider-jack-in
was the usual way to start a cider repl in emacs, but for some reason it doesn’t seem to work with luminus projects
Looks like it works the same way with figwheel too. lein figwheel
and lein run
in separate terminal tabs, then cider-connect-clj
in emacs, specify localhost and port 7002 at cider prompts, then run (cljs)
at repl
This is the full output of my repl after launching it:
nREPL server started on port 53640 on host localhost - <nrepl://localhost:53640>
;; Connected to nREPL server - <nrepl://localhost:53640>
;; CIDER 0.25.0snapshot, nREPL 0.7.0
;; Clojure 1.10.1, Java 1.8.0_222
;; Docs: (doc function-name)
;; (find-doc part-of-name)
;; Source: (source function-name)
;; Javadoc: (javadoc java-object-or-class)
;; Exit: <C-c C-q>
;; Results: Stored in vars *1, *2, *3, an exception in *e;
;; Startup: /Users/vraerek/bin/lein update-in :dependencies conj \[nrepl\ \"0.7.0\"\] -- update-in :dependencies conj \[cider/piggieback\ \"0.4.2\"\] -- update-in :plugins conj \[refactor-nrepl\ \"2.5.0\"\] -- update-in :plugins conj \[cider/cider-nrepl\ \"0.25.0-SNAPSHOT\"\] -- repl :headless :host localhost
;;
;; ClojureScript REPL type: figwheel
;; ClojureScript REPL init form: (do (require 'figwheel-sidecar.repl-api) (figwheel-sidecar.repl-api/start-figwheel!) (figwheel-sidecar.repl-api/cljs-repl))
;;
Figwheel: Starting server at <http://0.0.0.0:3449>
Figwheel: Watching build - app
Compiling build :app to "target/cljsbuild/public/js/app.js" from ["src/cljs" "src/cljc" "env/dev/cljs"]...
Successfully compiled build :app to "target/cljsbuild/public/js/app.js" in 1.474 seconds.
Figwheel: Starting CSS Watcher for paths ["resources/public/css"]
Figwheel: Starting nREPL server on port: 7002
Launching ClojureScript REPL for build: app
Figwheel Controls:
(stop-autobuild) ;; stops Figwheel autobuilder
(start-autobuild id ...) ;; starts autobuilder focused on optional ids
(switch-to-build id ...) ;; switches autobuilder to different build
(reset-autobuild) ;; stops, cleans, and starts autobuilder
(reload-config) ;; reloads build config and resets autobuild
(build-once id ...) ;; builds source one time
(clean-builds id ..) ;; deletes compiled cljs target files
(print-config id ...) ;; prints out build configurations
(fig-status) ;; displays current state of system
(figwheel.client/set-autoload false) ;; will turn autoloading off
(figwheel.client/set-repl-pprint false) ;; will turn pretty printing off
Switch REPL build focus:
:cljs/quit ;; allows you to switch REPL to another build
Docs: (doc function-name-here)
Exit: :cljs/quit
Results: Stored in vars *1, *2, *3, *e holds last exception object
Prompt will show when Figwheel connects to your application
user> (+ 1 1)
It just hangs after that last line
I had simular issue (spacemacs + lein new luminus myapp ... +cljs +reagent
) while trying to figure out how to make cljs repl work.
Atm I have such (usually working fine) workflow: while in project start repl with M-x cider-jack-in
then (start)
, then (start-fw)
.
If I need cljs repl, I type (cljs)
; cljs/quit
for returning to clj repl.
If cljs repl hangs or freezes, killing repl buffer (and process) and calling M-x cider-jack-in
helps. But it's rarely needed.
And yeah, I'm a newbie myself 🙂
huh. that’s interesting thanks for sharing your process. it’s not working for me, but maybe I can pick up on some clues here
when I follow what you outlined, I can see the luminus site at localhost:3000, where I’m greeted with the page “Congratulations, your luminus site is ready”, but localhost:3449 just says “Figwheel Server: Resource not found”. And the cider repl continues to hang after saying “Prompt will show when Figwheel connects to your application”
I wonder why luminus templates use lein-figwheel still, because it seems that figwheel-main is the current version of the tool