This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-05-23
Channels
- # aleph (9)
- # beginners (30)
- # boot (42)
- # carry (1)
- # cider (148)
- # clara (2)
- # cljsrn (13)
- # clojars (2)
- # clojure (90)
- # clojure-dev (1)
- # clojure-dusseldorf (2)
- # clojure-italy (7)
- # clojure-madison (1)
- # clojure-quebec (1)
- # clojure-russia (19)
- # clojure-sg (1)
- # clojure-spec (14)
- # clojure-uk (90)
- # clojurebridge (1)
- # clojurescript (70)
- # clr (7)
- # core-async (24)
- # cursive (26)
- # data-science (2)
- # datascript (3)
- # datomic (46)
- # devops (2)
- # emacs (6)
- # events (1)
- # figwheel (2)
- # hoplon (200)
- # klipse (2)
- # ldnclj (1)
- # lein-figwheel (4)
- # leiningen (3)
- # off-topic (44)
- # om (70)
- # other-languages (6)
- # pedestal (5)
- # protorepl (1)
- # re-frame (17)
- # reagent (14)
- # schema (2)
- # spacemacs (1)
- # specter (3)
- # test-check (38)
- # unrepl (38)
- # untangled (19)
- # yada (16)
I'm getting an error loading figwheel/piggieback repl in cider: `Exception 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.
example profile.clj code:
-----
:profiles {:dev {:dependencies [[com.cemerick/piggieback <current-version>]
[org.clojure/tools.nrepl <current-version>]]
:repl-options {:nrepl-middleware [cemerick.piggieback/wrap-cljs-repl]}}}
-----
Please see the documentation for piggieback here https://github.com/cemerick/piggieback#installation
Note: Cider will inject this config into your project.clj.
This can cause confusion when your are not using Cider. figwheel-sidecar.repl/eval28850/fn--28851 (repl.clj:166)
I've double-checked my profile.clj code, and it has all those dependenices and repl-options. Any other tips?
After the error, the cljs REPL comes up, but it doesn't recognize js/
as a valid namespace, and sending a form to the REPL triggers a message that the repl is misbehaving, urging me to report a bug.
@puzzler can you turn on nrepl-toggle-message-logging
and then try a command at the repl, even something crazy simple. The visit the logging buffer and we can see what type of repl we've got. it'll say it at the end, something like
(<--
id "16"
session "42da1513-54f2-4a29-b4b1-603d07a18434"
time-stamp "2017-04-30 11:20:56.987795668"
changed-namespaces (dict)
repl-type "cljs"
status ("state")
)
here notice repl-type
. This can help us find out if the cljs repl is starting at all, but my guess is its not and that's why js/
isn't recognized: the jvm clojure side has no idea what that is, and rightly sosome people have this hanging around from the brave clojure book and its tied to CIDER 0.8.2
profiles.clj file is a file that sets some standards across lein. are we talking about the same thing?
Yes, as you suspected, for some reason after the error, the clojurescript repl is just turned into a clojure repl.
I tried adding it again separately, and it complained that I couldn't set that variable twice.
Because back when things worked, I was getting compilation level none, which is how it is configured in dev. But now that things aren't working, I'm not as sure.
I've tried to compare my profile against the base template, to see what could have changed, and the main thing that has changed is I updated to the latest Clojure 1.9 alpha (template uses 1.8).
because they changed the namespaces in spec to include alpha and if the deps didn't update to do this the latest clojure 1.9 might not work for you
That's the next thing I was going to try. I needed to switch to 1.9, to make use of the cljs-oops library, so I'm not sure I can go back without my code breaking in other ways.
While I'm doing this, what's the quickest way to do shut down both clojure and clojurescript cider repls and restart them?
yeah the cljs repl gets started and doesn't know how to restart itself due to being intialized in a callback
could make a function that would kill buffers with REPL at the end of their name as well
that's the kind of hacky code that can go in your emacs but wouldn't be acceptable for CIDER
my guess is that some of your libs have 1.9a14 and some have 1.9a16 and they can't work together
we're trying to see if that is the problem to begin with. gonna roll back to 1.8 and see if this mess goes away
Will reading the output of lein deps :tree be useful here? To see the deps for various clojure versions?
Back on 1.8, the cljs file isn't compiling, and I'm still getting the error on top of that.
I can't find the error message, but I assume it's the cljs-oops, which is why I upgrade to 1.9.0-alpha16 in the first place.
[org.clojure/clojure "1.8.0"]
overrides
[rolling-stones "1.0.0-SNAPSHOT"] -> [org.clojure/clojure "1.9.0-alpha13"]
(ns rolling-stones.core
(:require [better-cond.core :as b]
[clojure.spec :as s]
[clojure.pprint])
(:import [org.sat4j.core VecInt]
org.sat4j.minisat.SolverFactory
org.sat4j.minisat.core.SolverStats
org.sat4j.tools.ModelIterator
[org.sat4j.specs ContradictionException TimeoutException ISolver IProblem]))
compared to spec here in cljs-oops:
(ns oops.config
"Code supporting static (compile-time) configuration. See defaults.clj for config map."
(:refer-clojure :exclude [gensym])
(:require [cljs.env]
[clojure.spec.alpha :as s]
[env-config.core :as env-config]
[oops.state]
[oops.helpers :as helpers :refer [gensym]]
[oops.defaults :as defaults]))
i've got to get to bed. is it possible we could continue tomorrow, perhaps with something i could clone to root around for issues?
I'll try to distill it down to something simple, and will let you know. Thanks for your help.
and i'm happy to help more tomorrow although i may be nearing the end of my ability to make educated guesses
@dpsutton I have it boiled down to a few reproducible steps now:
1. lein new luminus luminuscljs +cljs
2. Open emacs. Open luminuscljs/src/cljs/luminuscljs/core.cljs
.
3. cider-jack-in-clojurescript
4. After the figwheel repl starts up, wait a few minutes.
At this point, figwheel sometimes times out and reports an error here. If not, continue...
5. In the Clojure REPL, type (start)
6. In your browser (I used Chrome), open localhost:3000.
7. Wait a few more minutes, and you should see the error appear in emacs in the clojurescript repl.
@dpsutton This demonstrates an error out of the box with the luminus template and cider, indicating it has nothing to do with the specific of my project. Why did it work for me before? I have no idea. Did I imagine it? I'd have to rewind my version control to various points in time to try to figure that out. I filed an issue on luminus, but he responded that it appears to be more of a cider issue, since the project file seems correct.
Hmmm, I'm getting a slightly different, but similar error at the command line. Will add that to my luminus issue to see if that helps.
ok. following your bug report i'm able to get it running with lein run
and lein figwheel
but unable to get it working with CIDER
I just access it through the server (localhost:3000). I think you're right that figwheel also runs its own server which can be accessed through another port. I would have guessed 3449.
By backtracking to last week's commit that worked, I was able to track it down to my bumping up the version of figwheel and figwheel-sidecar from 0.5.9 to 0.5.10. My browser had cached something from the older version.
Once I forced the browser to refresh and ignore the cache, everything was happy again.
It was useful to know that you got it working on your system with the exact same project template, because that really helped narrow it down to something quirky on my system, in this case, browser state.
How to get current cider project name with elisp function?
nrepl-project-dir is a variable defined in ‘nrepl-client.el’.
Its value is "~/projects/clojure/luminuscljs/"
Local in buffer *cider-repl luminuscljs*; global value is nil
Automatically becomes buffer-local when set.
also from clojure-mode:
(defun clojure-project-dir (&optional dir-name)
"Return the absolute path to the project's root directory.
Use `default-directory' if DIR-NAME is nil.
Return nil if not inside a project."
(let* ((dir-name (or dir-name default-directory))
(choices (delq nil
(mapcar (lambda (fname)
(locate-dominating-file dir-name fname))
clojure-build-tool-files))))
(when (> (length choices) 0)
(car (sort choices #'file-in-directory-p)))))
@dpsutton I tried nrepl-project-dir
, but in project source code file, it is nil
.
I will try clojure-project-dir
.
sorry, I did get it from buffer,
Oh, I see.
Here is the step, I jacked in project, and open the project source code file as buffer, then use a function to get the variable nrepl-project-dir
's value to used in a custom mode-line.
yeah that var is only in the repl buffer (which is kinda the same thing as the connection buffer)
Restarting Emacs to take a try. buffer-local-value
and (with-current-buffer (cider-current-connection)
Thanks very much
Good morning! Does anyone in here know how Cider selects a value for cider-cljs-lein-repl
? I just lost a merry while trying to figure out what the heck was trying to bring figwheel
in to a project that doesn’t use it.
gastove: https://github.com/clojure-emacs/cider/blob/a82bfbebe8c3e470321ec79df5c08d49f3709bb1/cider.el#L458 it deafults to a rhino repl
if you want it to be anything else, you have to manually set it in you .emacs config
that’s probably a better way to do it than what I was doing…which involved loading libraries
actually, let’s not talk about how I did, .dir-locals.el
is a far better idea