Fork me on GitHub
#figwheel-main
<
2020-06-22
>
DrLjótsson09:06:18

I'm trying to figure out how to get a proper clojurescript repl running in Cursive using piggieback. But I can't get it to work. I've followed the advise on https://whynotsoftware.github.io/Migrating-From-Lein-Figwheel-To-Figwheel-Main/

DrLjótsson09:06:38

I get this error message

DrLjótsson09:06:38

Execution error (ExceptionInfo) at figwheel.main/nrepl-repl (main.cljc:1527). Failed to launch Figwheel CLJS REPL: nREPL connection found but unable to load piggieback. This is commonly caused by A) not providing piggieback as a dependency and/or B) not adding piggieback middleware into your nrepl middleware chain. Please see the documentation for piggieback here https://github.com/clojure-emacs/piggieback#installation Note: Cider will inject this config into your project.clj. This can cause confusion when your are not using Cider.

DrLjótsson10:06:44

I have included [cider/piggieback "0.5.0"] as a dev dependency, [cider/cider-nrepl "0.25.2"] as a plugin and added :nrepl-middleware [cider.piggieback/wrap-cljs-repl] to :repl-options

DrLjótsson10:06:53

Anyone have an idea?

dominicm13:06:15

@brjann how did you start your repl?

DrLjótsson17:06:44

This is an existing server-side project that I've added cljs to. So I alredy have a nREPL running that I access as a remote REPL using the run command.

DrLjótsson17:06:50

It is from this repl that i tried to run (require '[figwheel.main.api :as f]) (f/start {:mode :serve} "dev") (f/cljs-repl "dev")

DrLjótsson17:06:53

The last command fails

DrLjótsson17:06:29

TBH I don't really understand what I am doing. For the minute I start figwheel from the terminal using lein fig -- --build dev --repl

bhauman17:06:13

you need to follow the instructions as provided in that article

DrLjótsson17:06:32

The migrating article?

bhauman17:06:40

it uses lein repl

bhauman17:06:49

to start nREPL

bhauman17:06:17

which includes the piggiback middleware

DrLjótsson17:06:27

Oh, and the cursive repl does not?

bhauman17:06:24

apparently not?

DrLjótsson17:06:36

I guess not...

bhauman17:06:48

you should also change the :init to you startup code for figwheel

DrLjótsson17:06:07

Ok, now I have it running in the terminal! But can I add it "within" Cursive, with syntax highlighting and stuff?

DrLjótsson18:06:20

However, it's not using the figwheel config that I intended. In my figwheel-main.edn i have :watch-dirs ["src/cljs" "src/cljc" "test/cljs"] and :open-url false , which works fine when I run lein fig -- --build dev --repl

DrLjótsson18:06:54

But (f/start {:mode :serve} "dev") gives this output

DrLjótsson18:06:55

user=> (f/start {:mode :serve} "dev") [Figwheel] Validating figwheel-main.edn [Figwheel] figwheel-main.edn is valid \(ツ)/ [Figwheel] Compiling build dev to "target/public/js/main.js" [Figwheel] Successfully compiled build dev to "target/public/js/main.js" in 4.967 seconds. [Figwheel] Outputting main file: target/public/js/main-auto-testing.js [Figwheel] Watching paths: ("src/cljs") to compile build - dev [Figwheel] Starting Server at http://localhost:9500 Opening URL http://localhost:9500

DrLjótsson18:06:17

So it's not watching the right directories and opens the URL. What am I missing?

DrLjótsson18:06:02

Also, the port should be 2020, not 9500

DrLjótsson18:06:52

Oh, maybe {:mode :serve} replaces the figwheel-main.edn?

Abhinav Sharma18:06:24

Hello everyone, I'm running on windows10 (therefore, Leiningen) and trying to connect to the NodeJS reply, using the devtools. The REPL setup works fine for the browser build, however it seems I'm making some mistake with the NodeJS repl config. Here's my setup

Abhinav Sharma18:06:26

I'd be happy to test things out wrt windows and update the docs as indicated here https://github.com/bhauman/figwheel-main/issues/250

DrLjótsson18:06:44

@bhauman: I got it working now. You were right, follow the instructions... Thank you!

👍 3
bhauman18:06:37

@abhi18av yes I will definitely take a PR if you figure this out

bhauman18:06:11

I’m not on windows so … it’s tough for me, I’m always looking for folks to take on windows support

Abhinav Sharma18:06:05

@bhauman - Cool 👍 Just to confirm, did you notice anything odd in the config at all?

Abhinav Sharma19:06:41

Update: The config seems fine, I tried the same on a mac machine and worked the first time. Tough the differece which I noticed is that the chrome canary I'm using on windows doesn't display the "NodeJS" (green icon) in the devtools at all. Perhaps, it's not able to sense/located the node --inspect command which is initiated by Figwheel

Abhinav Sharma18:06:00

I've tried the lein fig:nodejs on the terminal as well - no luck

Abhinav Sharma18:06:28

Is there any example, gist I could take a hint from?

Abhinav Sharma19:06:41

Update: The config seems fine, I tried the same on a mac machine and worked the first time. Tough the differece which I noticed is that the chrome canary I'm using on windows doesn't display the "NodeJS" (green icon) in the devtools at all. Perhaps, it's not able to sense/located the node --inspect command which is initiated by Figwheel