This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-02-05
Channels
- # announcements (17)
- # architecture (5)
- # babashka (12)
- # beginners (155)
- # calva (18)
- # chlorine-clover (2)
- # cider (57)
- # circleci (2)
- # clojure (151)
- # clojure-europe (4)
- # clojure-gamedev (20)
- # clojure-italy (18)
- # clojure-nl (4)
- # clojure-norway (3)
- # clojure-spec (8)
- # clojure-uk (95)
- # clojurescript (70)
- # core-async (68)
- # css (3)
- # data-science (13)
- # datascript (1)
- # datomic (16)
- # docker (2)
- # figwheel-main (41)
- # fulcro (34)
- # graalvm (6)
- # graphql (7)
- # jobs (14)
- # joker (2)
- # kaocha (1)
- # leiningen (2)
- # malli (3)
- # midje (2)
- # overtone (1)
- # reagent (8)
- # reitit (6)
- # ring-swagger (1)
- # schema (2)
- # shadow-cljs (6)
- # spacemacs (3)
- # specter (5)
- # timbre (3)
- # uncomplicate (1)
Hi everyone, I am struggling to get CIDER connected to a CLJS REPL using Figwheel.
I can get to this:
Figwheel: Stopped watching build - admin
Figwheel: Stopping Websocket Server
Figwheel: Starting server at
Figwheel: Watching build - admin
Compiling build :admin to "resources/public/js/admin.js" from ["src/cljs" "src/cljc" "test/cljs"]...
Successfully compiled build :admin to "resources/public/js/admin.js" in 1.408 seconds.
Launching ClojureScript REPL for build: admin
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>
but the prompt is still user>
which is not what I want
If I look in the browser, I see:
[Figwheel REPL] Session ID: 2bae1fc5-52ca-4b0c-bc34-60ec5e85ff6b console.js:203:20 [Figwheel REPL] Session Name: Brant console.js:203:20
So, if I understand correctly Figwheel has connected to the application
ClojureScript REPL init form: (do (use 'figwheel-sidecar.repl-api) (start-figwheel!) (cljs-repl))
I don't see any complaints from CIDER about missing dependencies, but I don't get the desired repl.
Is it relevant that I get the same Figwheel REPL session name when I reload the page?
@dpsutton yes, that works
Attempting to run this inside inf-clojure
I got a somewhat more revealing error message:
Prompt will show when REPL connects to evaluation environment (i.e. a REPL hosting webpage)
Figwheel Main Controls:
(figwheel.main/stop-builds id ...) ;; stops Figwheel autobuilder for ids
(figwheel.main/start-builds id ...) ;; starts autobuilder focused on ids
(figwheel.main/reset) ;; stops, cleans, reloads config, and starts autobuilder
(figwheel.main/build-once id ...) ;; builds source one time
(figwheel.main/clean id ...) ;; deletes compiled cljs target files
(figwheel.main/status) ;; displays current state of system
Figwheel REPL Controls:
(figwheel.repl/conns) ;; displays the current connections
(figwheel.repl/focus session-name) ;; choose which session name to focus on
In the cljs.user ns, controls can be called without ns ie. (conns) instead of (figwheel.repl/conns)
Docs: (doc function-name-here)
Exit: :cljs/quit
Results: Stored in vars *1, *2, *3, *e holds last exception object
Syntax error (SocketException) compiling at (/tmp/form-init8063575831097884698.clj:1:73).
Permission denied
Full report at:
/tmp/clojure-8929986480762187171.edn
Process inf-clojure exited abnormally with code 1
I get the same Socket Exception error as just above when running it from the command line.
Well it maybe depends on how lein is being started... Clearly the project is working when it is run in Docker (as I said, I can connect via a web browser)
I am running it with lein repl
now and I see:
[Figwheel] Successfully compiled build shared to "target/public/cljs-out/shared-main.js" in 25.204 seconds.
[Figwheel] Watching paths: ("src/cljs" "src/cljc" "test/cljs") to compile build - shared
[Figwheel] Starting Server at
JavaScript environment will not launch automatically when :open-url is false
"To start a cljs repl call `(figwheel/cljs-repl \"app\")`"
"where `app` is the build you want to attach to."
nREPL server started on port 3888 on host 0.0.0.0 -
REPL-y 0.4.3, nREPL 0.6.0
Clojure 1.10.1
OpenJDK 64-Bit Server VM 1.8.0_242-8u242-b08-0ubuntu3~18.04-b08
Docs: (doc function-name-here)
(find-doc "part-of-name-here")
Source: (source function-name-here)
Javadoc: (javadoc java-object-or-class-here)
Exit: Control+D or (exit) or (quit)
Results: Stored in vars *1, *2, *3, an exception in *e
user=>
The socket error came when starting it with lein fig -- -bb shared -bb shopping -b admin -r
. It seems to go better without the extra instructions.
@holtzermann17 https://clojurians.slack.com/archives/C0617A8PQ/p1580913198082800 why is this not what you want? what are you wanting?
Here's an interaction log on the command line:
$ lein repl
2020-02-05 17:19:03.291:INFO::main: Logging initialized @4551ms to org.eclipse.jetty.util.log.StdErrLog
"To start a cljs repl call `(figwheel/cljs-repl \"app\")`"
"where `app` is the build you want to attach to."
nREPL server started on port 3888 on host 0.0.0.0 -
REPL-y 0.4.3, nREPL 0.6.0
Clojure 1.10.1
OpenJDK 64-Bit Server VM 1.8.0_242-8u242-b08-0ubuntu3~18.04-b08
Docs: (doc function-name-here)
(find-doc "part-of-name-here")
Source: (source function-name-here)
Javadoc: (javadoc java-object-or-class-here)
Exit: Control+D or (exit) or (quit)
Results: Stored in vars *1, *2, *3, an exception in *e
user=> (use 'figwheel-sidecar.repl-api)
(use 'figwheel-sidecar.repl-api
nil
user=> (start-figwheel!)
(start-figwheel!
Figwheel: Starting server at
Figwheel: Watching build - admin
Figwheel: Cleaning build - admin
Compiling build :admin to "resources/public/js/admin.js" from ["src/cljs" "src/cljc" "test/cljs"]...
WARNING: cljs.core/<=, all arguments must be numbers, got [#{nil js/Number} number] instead at line 1193 resources/public/js/admin/clojure/test/check/generators.cljc
WARNING: cljs.core/<=, all arguments must be numbers, got [#{nil js/Number} number] instead at line 1193 resources/public/js/admin/clojure/test/check/generators.cljc
WARNING: Cannot resolve property getElementById for inferred type js/HTMLDocument in expression (. js/document getElementById "app") at line 14 src/cljs/com/openmarkets/exchange/ui/shopping/core.cljs
Successfully compiled build :admin to "resources/public/js/admin.js" in 34.411 seconds.
nil
user=> (cljs-repl)
(cljs-repl
Launching ClojureScript REPL for build: admin
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
When I browse to 0.0.0.0:3449 I see a white page, and I found this interesting error in the log: "ClojureScript could not load :main, did you forget to specify :asset-path?"
So, yeah, this a CIDER issue as far as I can tell!
I will ask in the #figwheel channel.
OK, I have managed to connect CIDER to the app
But I am running into another error
The backtrace indicates that it may have to do with cider piggieback
... Do I even need cider-piggieback?
My sense is that I do
I think the problem was that I was browsing to the base URL in the project, not the relevant path from whith to engage with the particular app. Now that I am past that, here are my interactions leading to the next error:
user> (require '[figwheel-sidecar.repl-api :as fs])
nil
user> (figwheel/cljs-repl "admin")
Prompt will show when REPL connects to evaluation environment (i.e. a REPL hosting webpage)
Figwheel Main Controls:
(figwheel.main/stop-builds id ...) ;; stops Figwheel autobuilder for ids
(figwheel.main/start-builds id ...) ;; starts autobuilder focused on ids
(figwheel.main/reset) ;; stops, cleans, reloads config, and starts autobuilder
(figwheel.main/build-once id ...) ;; builds source one time
(figwheel.main/clean id ...) ;; deletes compiled cljs target files
(figwheel.main/status) ;; displays current state of system
Figwheel REPL Controls:
(figwheel.repl/conns) ;; displays the current connections
(figwheel.repl/focus session-name) ;; choose which session name to focus on
In the cljs.user ns, controls can be called without ns ie. (conns) instead of (figwheel.repl/conns)
Docs: (doc function-name-here)
Exit: :cljs/quit
Results: Stored in vars *1, *2, *3, *e holds last exception object
Open URL
To quit, type: :cljs/quit
nil
cljs.user> (require 'cljs.analyzer.api)
nil
cljs.user> (cljs.analyzer.api/all-ns)
And here is the error:Show: Project-Only All
Hide: Clojure Java REPL Tooling Duplicates (12 frames hidden)
1. Unhandled clojure.lang.ExceptionInfo
#object[Error Error: No protocol method IDeref.-deref defined for
type null: ]
{:type :js-eval-exception,
:error
{:status :exception,
:value
"#object[Error Error: No protocol method IDeref.-deref defined for type null: ]",
:ua-product :firefox,
:stacktrace
"cljs$core$missing_protocol@http://exchange-cljs.test/cljs-out/admin/cljs/core.js:309:9\ncljs$core$_deref@http://exchange-cljs.test/cljs-out/admin/cljs/core.js:2162:17\ncljs$core$deref@http://exchange-cljs.test/cljs-out/admin/cljs/core.js:4927:18\ncljs.analyzer.api.all_ns.cljs$core$IFn$_invoke$arity$1@http://exchange-cljs.test/cljs-out/admin/cljs/analyzer/api.js?zx=huuvsoaczikn:197:73\ncljs$analyzer$api$all_ns@http://exchange-cljs.test/cljs-out/admin/cljs/analyzer/api.js?zx=huuvsoaczikn:183:33\ncljs.analyzer.api.all_ns.cljs$core$IFn$_invoke$arity$0@http://exchange-cljs.test/cljs-out/admin/cljs/analyzer/api.js?zx=huuvsoaczikn:193:33\ncljs$analyzer$api$all_ns@http://exchange-cljs.test/cljs-out/admin/cljs/analyzer/api.js?zx=huuvsoaczikn:179:33\n@http://exchange-cljs.test/cljs-out/admin/figwheel/repl.js line 751 > eval:1:94\n@http://exchange-cljs.test/cljs-out/admin/figwheel/repl.js line 751 > eval:9:3\nfigwheel$repl$eval_javascript_STAR__STAR_@http://exchange-cljs.test/cljs-out/admin/figwheel/repl.js:751:24\n@http://exchange-cljs.test/cljs-out/admin/figwheel/repl.js:799:56\nG__12816__2@http://exchange-cljs.test/cljs-out/admin/cljs/core.js:35676:106\nG__12816@http://exchange-cljs.test/cljs-out/admin/cljs/core.js:35943:20\nfigwheel.repl.ws_connect.cljs$core$IFn$_invoke$arity$variadic/</<@http://exchange-cljs.test/cljs-out/admin/figwheel/repl.js:1053:30\ngoog.events.EventTarget.prototype.fireListeners@http://exchange-cljs.test/cljs-out/admin/goog/events/eventtarget.js:284:23\ngoog.events.EventTarget.dispatchEventInternal_@http://exchange-cljs.test/cljs-out/admin/goog/events/eventtarget.js:381:26\ngoog.events.EventTarget.prototype.dispatchEvent@http://exchange-cljs.test/cljs-out/admin/goog/events/eventtarget.js:196:34\<http://ngoog.net|ngoog.net>.WebSocket.prototype.onMessage_@http://exchange-cljs.test/cljs-out/admin/goog/net/websocket.js:426:8\n"},
:form (cljs.analyzer.api/all-ns),
:js
"try{cljs.core.pr_str.call(null,(function (){var ret__6754__auto__ = cljs.analyzer.api.all_ns.call(null);\n(cljs.core._STAR_3 = cljs.core._STAR_2);\n\n(cljs.core._STAR_2 = cljs.core._STAR_1);\n\n(cljs.core._STAR_1 = ret__6754__auto__);\n\nreturn ret__6754__auto__;\n})());\n}catch (e184785){var e__6755__auto___184786 = e184785;\n(cljs.core._STAR_e = e__6755__auto___184786);\n\nthrow e__6755__auto___184786;\n}"}
repl.cljc: 578 cljs.repl$evaluate_form/invokeStatic
repl.cljc: 499 cljs.repl$evaluate_form/invoke
piggieback_impl.clj: 207 cider.piggieback/eval-cljs
piggieback_impl.clj: 206 cider.piggieback/eval-cljs
piggieback_impl.clj: 243 cider.piggieback/do-eval/fn
AFn.java: 152 clojure.lang.AFn/applyToHelper
AFn.java: 144 clojure.lang.AFn/applyTo
core.clj: 665 clojure.core/apply
core.clj: 1973 clojure.core/with-bindings*
core.clj: 1973 clojure.core/with-bindings*
RestFn.java: 425 clojure.lang.RestFn/invoke
piggieback_impl.clj: 220 cider.piggieback/do-eval
piggieback_impl.clj: 219 cider.piggieback/do-eval
piggieback_impl.clj: 266 cider.piggieback/evaluate
piggieback_impl.clj: 264 cider.piggieback/evaluate
Var.java: 384 clojure.lang.Var/invoke
piggieback_impl.clj: 297 cider.piggieback/wrap-cljs-repl/fn/fn/fn
piggieback_impl.clj: 190 cider.piggieback/enqueue/fn
AFn.java: 22 clojure.lang.AFn/run
session.clj: 171 nrepl.middleware.session/session-exec/main-loop/fn
session.clj: 170 nrepl.middleware.session/session-exec/main-loop
AFn.java: 22 clojure.lang.AFn/run
Thread.java: 834 java.lang.Thread/run
Maybe this, again, hasn't got anything to do with CIDER
But I see all of these mentions of cider.piggieback in the trace
I reported this one a few weeks ago on spacemacs' github but so far it hasn't gotten any response: https://github.com/syl20bnr/spacemacs/issues/13193
Hey there, I have a [kinda quiet] thread going on figwheel-main but I thought here would be a good place to ask these questions too.
I'm wondering what happens when you cider-jack-in-clj&cljs
?
1. I'm using figwheel-main and deps.end, I'm wondering if there's going to be just one nREPL server (the one figwheel starts) and then cider just opens up two client connections, one for clj and one for cljs.
2. Another source of confusion is that, when starting figwheel-main from command line, I don't see which port it is running on, only the HTTP server port. I think I saw a .nrepl.port file being created on the folder of the project but I don't know under which circumstances and by whom (is it figwheel or cider?) Will that be there if I start the repl from the command line?
My use case: I want to write a "full stack" clojure app, I'm writing some middleware to handle the API for the cljs app. I'd like to connect to a clj REPL to interact with the code of the ring-middleware mounted by figwheel, but also be able to connect to the cljs repl in order to interact with the browser code.
just quickly answering my own questions: 1. I'm pretty sure the answer is yes, a single nREPL is enough for clj+cljs, the piggieback middleware handles the cljs specific evaluations 2. That file seems to be created by nrepl's cmd line utility: https://github.com/nrepl/nrepl/blob/be37e0ebd13c2d341bf6a7bcd5735da45b78f909/src/clojure/nrepl/cmdline.clj#L403 which cider uses when jacking-in.
I'm sure there's a way to specify a custom nREPL port too, but haven't found it so far.
Founds this repo that just worked when running cider-jack-in-clj&cljs
https://github.com/EmmanuelOga/deps-cider-cljs-reagent/blob/master/.dir-locals.el
More details here: https://clojurians.slack.com/archives/CALJ3BFLP/p1580899631068000
EOF! 🙂
ah! btw, here's the command cider is running for that particular repo
clojure -A:cider -Sdeps '{:deps {nrepl {:mvn/version ""0.6.0""} cider/piggieback {:mvn/version ""0.4.2""} cider/cider-nrepl {:mvn/version ""0.23.0""}}}' -m nrepl.cmdline --middleware '[""cider.nrepl/cider-middleware"", ""cider.piggieback/wrap-cljs-repl""]'
...and there it is the -m nrepl.cmdline
part that invokes the code that writes teh port to that file
if its the interaction between clojure-mode and another package configured through spacemacs probably not much we can do in CIDER
@dpsutton can you take a look at the issue I reported in spacemacs? It’s definitely a bug in the clojure layer of spacemacs