figwheel

general discussion about figwheel, specific discussions in #figwheel-main and #lein-figwheel
reefersleep 2020-05-01T06:58:03.010400Z

To describe my problem in more detail: The REPL compiles my CLJS and starts the browser off at localhost:3449 as expected, and the compiled js is shown in the browser. The REPL never gets a prompt, though. There are some errors in the browser console, but they seem insignificant - something about not having a favicon, something about not being able to load source-maps. Usually when I’ve started localhost:3449 up for an app, and the browser cannot connect to the REPL (because it’s not running), the browser repeatedly states that it’s unable to connect to figwheel. This does not happen here; there are no connection-related messages in the browser console.

reefersleep 2020-05-01T06:58:31.010900Z

I run lein figwheel in the terminal, so the problem is not related to IntelliJ or Cider or whatever.

2020-05-01T09:58:07.012100Z

@reefersleep do you have clj code involved? Did it compile? lein check on your project

reefersleep 2020-05-01T10:03:25.012900Z

Nope, they’re CLJS only - that’s the -frontend part of the reagent-frontend template I’ve used 🙂

reefersleep 2020-05-01T10:03:39.013300Z

lein check yields no response, @mikerod

reefersleep 2020-05-01T10:05:24.014400Z

I did not update dependencies or otherwise manipulate all of those projects in a similar manner at once, so I suspected that maybe I had somehow had something rotten in .m2. Tried deleting it and building anew, no difference.

reefersleep 2020-05-01T10:05:57.015Z

I also restarted my computer, just for the heck of it. No difference.

2020-05-01T10:08:02.016700Z

Can you run perhaps lein cljsbuild commands successfully. Just seeing if you can reduce it down more. Perhaps not.

reefersleep 2020-05-01T10:08:05.016800Z

To be clear; I was working on one project, and figwheel stopped working for all projects, most of which I haven’t touched in a long time.

reefersleep 2020-05-01T10:08:35.017200Z

lein cljsbuild once seems to work fine.

reefersleep 2020-05-01T10:09:09.017800Z

lein figwheel compiles fine as well, I get all of the usual output, right down to

Successfully compiled "resources/public/js/compiled/bouncy.js" in 3.641 seconds.
Figwheel: Starting CSS Watcher for paths  ["resources/public/css"]
Figwheel: Starting nREPL server on port: 7002
Launching ClojureScript REPL for build: dev
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
  Switch REPL build focus:
          :cljs/quit                      ;; allows you to switch REPL to another build
    Docs: (doc function-name-here)
    Exit: Control+C or :cljs/quit
 Results: Stored in vars *1, *2, *3, *e holds last exception object
Prompt will show when Figwheel connects to your application

reefersleep 2020-05-01T10:09:25.018200Z

I just never get that prompt, because the connection is never established, as far as I can tell.

reefersleep 2020-05-01T10:09:48.018700Z

The weird thing is that the browser does not report that it failed to establish the connection! (Which it usually does when the app is running in dev mode, and I close my REPL)

reefersleep 2020-05-01T10:12:48.019600Z

OK, so figwheel-main works, and it runs on a different port. I’ll try changing the :server-port for figwheel from the default 3449 to 3450.

reefersleep 2020-05-01T10:14:44.019800Z

No difference.

reefersleep 2020-05-01T10:16:51.020300Z

I’ll try 9500, that’s what figwheel-main uses.

reefersleep 2020-05-01T10:19:23.020600Z

No difference.

2020-05-01T12:19:56.021500Z

@reefersleep using your browser dev tools are you seeing any index page being server at all when you hit your figwheel server port?

2020-05-01T12:20:39.022600Z

If it is serving you some response assets. Look around through the source some. See if you see what you expect there. Figwheel js and your project js files.

2020-05-01T12:20:48.022900Z

Just trying to find where your breakdown is

reefersleep 2020-05-01T15:19:45.023200Z

reefersleep 2020-05-01T15:20:17.023900Z

I see the index page, my js… Not any figwheel stuff, from what I can tell

reefersleep 2020-05-01T20:11:09.025Z

@mikerod thanks for the suggestions. I haven’t progressed much; been working all day, on my work computer 🙂 I think I’m going to look in it some more, now. It’s curious, for one, that there doesn’t seem to be any figwheel code assets, there seemed to be on my work project.

2020-05-01T20:12:01.025400Z

every so often if a figwheel thing fails too early on it can be difficult to get any debugging info from it

2020-05-01T20:12:10.025700Z

clj compilation failures tend to be quite opaque on startup

2020-05-01T20:12:20.026Z

cljs ones I think tend to be a bit more clearly stated

reefersleep 2020-05-01T20:17:21.026200Z

Right.

reefersleep 2020-05-01T20:20:51.027100Z

The thing is, it’s a system-wide thing, it seems. If I do lein new reagent-frontend my-new-project and cd into that, and lein figwheel, I get exactly the same problem.

reefersleep 2020-05-01T20:21:35.027900Z

That’s why I thought maybe it was a port thing. I mean, I don’t know how, but maybe I’d messed up some routing in my system…. ????

reefersleep 2020-05-01T20:21:45.028200Z

Grasping at straws here

reefersleep 2020-05-01T20:39:49.029200Z

The my-new-project I just created has figwheel code loaded into the browser, but still does not connect to the repl.

reefersleep 2020-05-01T21:04:22.030100Z

I tried lein new figwheel hello-world, and this manages to connect to the repl! Now I just have to figure out what the difference is.

reefersleep 2020-05-01T22:21:38.030400Z

“just”.

reefersleep 2020-05-01T22:40:15.033400Z

There seem to be so few differences between these two things, and yet it’s taking so long to sort it out. I give up. I’m going to create a new application with lein new figwheel and move whatever code I want to work with in there. I’ve been in these situations before, and it’s maybe the suckiest side of Clojure - my tools or build chain just stops working for strange, indecipherable reasons, and I spend wayyyy too long trying to figure out why.