Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Having issues with cider-nrepl 0.11.0-snapshot + boot + cljs-repl #301

Closed
samedhi opened this issue Feb 21, 2016 · 17 comments
Closed

Having issues with cider-nrepl 0.11.0-snapshot + boot + cljs-repl #301

samedhi opened this issue Feb 21, 2016 · 17 comments

Comments

@samedhi
Copy link

samedhi commented Feb 21, 2016

I am using boot, I can correctly cider-connect to my boot repl. I can also start up a cljs repl by typing (start-repl) within cider-repl. I can confirm that this does work because I can see the results of the following:

boot.user> (start-repl)
<< started Weasel server on ws://127.0.0.1:60722 >>
<< waiting for client to connect ... Connection is ws://localhost:60722
Writing boot_cljs_repl.cljs...
 connected! >>
To quit, type: :cljs/quit
nil
cljs.user> (+ 2 3)
5
cljs.user> (js/alert "hello”) ;; The js alert dialog popped up
nil

However, I can’t do any actual cider commands. C-x C-e for instance returns

user-error: `cider-eval-last-sexp' needs a Clojure REPL.
If you don't know what that means, you probably need to jack-in (`C-c M-j’).

Therefore I have downgraded cider-nrepl from [cider/cider-nrepl “0.11.0-snapshot”] to [cider/cider-nrepl "0.10.2”]. The cljs repl now seem to work again, though naturally I am now getting CIDER's version (0.11.0-snapshot) does not match cider-nrepl's version (0.10.2). Things will break!

@Malabarba
Copy link
Member

However, I can’t do any actual cider commands. C-x C-e for instance returns

Is that on a Clojure, ClojureScript, or ClojureC file?

@samedhi
Copy link
Author

samedhi commented Feb 21, 2016

C-x C-e is on a cljs file. I am free to work all of cider's magic before calling (start-repl), it is only after calling (start-repl) that it does not seem to think it has a clojure repl.

@samedhi
Copy link
Author

samedhi commented Feb 21, 2016

Also, I seem to again have the same errors with cider-nrepl 10.2.0 . I know I had it working for a few hours (I have been working in cljs for the last few), but somehow it has stopped working again upon reboot... 😞

@Malabarba
Copy link
Member

@samedhi When you run (start-repl) you turn that Clojure REPL into a ClojureScript REPL. If that was your only REPL, then you no longer have a Clojure repl.
That's why CIDER says you don't have a Clojure REPL.

The issue here seems to be that you get this message in .cljs files. When you type C-x C-e in a .cljs file, CIDER should look for a ClojureScript REPL (which you do have), instead of complaining about the lack of a Clojure REPL.


I'll check if there's anything wrong with the logic. But the message you're getting wasn't even implemented in version 0.10.2, so it would be good to check if you have your versions right.

@samedhi
Copy link
Author

samedhi commented Feb 22, 2016

Sorry, yes, I put it back to 0.11.0-snapshot, as that seemed to be a false start.

M-x cider-version => CIDER 0.11.0snapshot (package: 20160218.247)

@samedhi
Copy link
Author

samedhi commented Feb 22, 2016

Just to start things off, here is the task I am trying to run

(deftask development
  "Launch Immediate Feedback Development Environment"
  []
  (comp
   (serve :reload true)
   (reload)
   (watch)
   (cljs-repl)
   (cljs)
   (target :dir #{"target"})))

here is my profile.boot

(require 'boot.repl)

(swap! boot.repl/*default-dependencies*
       concat '[[refactor-nrepl "2.2.0-SNAPSHOT"]
                [cider/cider-nrepl "0.11.0-SNAPSHOT"]
                [org.clojure/tools.nrepl "0.2.12" :scope "test"]])

(swap! boot.repl/*default-middleware*
       concat
       '[[cider.nrepl/cider-middleware]
         [refactor-nrepl.middleware/wrap-refactor]])

@Malabarba
Copy link
Member

Don't you need clojurescript as a dependency somewhere?

@samedhi
Copy link
Author

samedhi commented Feb 22, 2016

Full build.boot

(set-env!
 :source-paths #{"src"}
 :resource-paths #{"html"}
 :dependencies '[[adzerk/boot-cljs             "1.7.228-1"]
                 [adzerk/boot-reload           "0.4.5"]
                 [adzerk/boot-test             "1.1.0"]
                 [adzerk/boot-cljs-repl        "0.3.0"]
                 [binaryage/devtools           "0.5.2"]
                 [cljsjs/media-stream-recorder "1.2.6-0"]
                 [compojure                    "1.4.0"]
                 [com.cemerick/piggieback      "0.2.1"]
                 [datascript                   "0.15.0"]
                 [hiccup                       "1.0.5"]
                 [http-kit                     "2.1.18"]
                 [org.clojure/clojure          "1.8.0"]
                 [org.clojure/clojurescript    "1.7.228"]
                 [org.clojure/core.async       "0.2.374"]
                 [org.clojure/test.check       "0.9.0"]
                 [org.clojure/tools.nrepl      "0.2.12"]
                 [org.omcljs/om                "1.0.0-alpha23"]
                 [pandeiro/boot-http           "0.7.2"]
                 [ring                         "1.4.0-RC2"]
                 [weasel                       "0.7.0"]])

(require '[adzerk.boot-cljs      :refer [cljs]]
         '[adzerk.boot-cljs-repl :refer [cljs-repl start-repl]]
         '[adzerk.boot-reload    :refer [reload]]
         '[adzerk.boot-test      :refer [test]]
         '[pandeiro.boot-http    :refer [serve]])

(task-options!
 serve {:handler 'vidioting.server/handler
        :httpkit true
        :port 8080
        :resource-root "target"})

(deftask autotest
  "Runs test automatically on file change"
  []
  (comp
   (test)
   (speak)
   (watch)))

(deftask development
  "Launch Immediate Feedback Development Environment"
  []
  (comp
   (serve :reload true)
   (reload)
   (watch)
   (cljs-repl)
   (cljs)
   (target :dir #{"target"})))

(deftask build
  "Builds cljs and code for production"
  []
  (comp
     (cljs :optimizations :advanced)
     (target :dir #{"target"})))

(deftask production
  "Runs server in production mode"
  []
  (comp
   (serve :reload false)
   (wait)))

@Malabarba
Copy link
Member

Hi there. I'm trying to reproduce the problem, but I can't get a repl going (even without CIDER).
I get an exception right after the << waiting for client to connect ... (see below).
If I run boot development (instead of boot repl) I also get an exception (albeit different).

Do you know what I might be doing wrong?

% ~/Work/lalala 0 boot repl
nREPL server started on port 36903 on host 127.0.0.1 - nrepl://127.0.0.1:36903
Implicit target dir is deprecated, please use the target task instead.
Set BOOT_EMIT_TARGET=no to disable implicit target dir.
REPL-y 0.3.7, nREPL 0.2.12
Clojure 1.8.0
OpenJDK 64-Bit Server VM 1.8.0_74-b02
        Exit: Control+D or (exit) or (quit)
    Commands: (user/help)
        Docs: (doc function-name-here)
              (find-doc "part-of-name-here")
Find by Name: (find-name "part-of-name-here")
      Source: (source function-name-here)
     Javadoc: (javadoc java-object-or-class-here)
    Examples from clojuredocs.org: [clojuredocs or cdoc]
              (user/clojuredocs name-here)
              (user/clojuredocs "ns-here" "name-here")
boot.user=> (start-repl)
<< started Weasel server on ws://127.0.0.1:35592 >>
<< waiting for client to connect ... 
java.lang.NullPointerException
    at clojure.java.io$make_parents.invokeStatic(io.clj:443)
    at clojure.java.io$make_parents.doInvoke(io.clj:438)
    at clojure.lang.RestFn.invoke(RestFn.java:410)
    at adzerk.boot_cljs_repl$make_repl_connect_file.invokeStatic(boot_cljs_repl.clj:43)
    at adzerk.boot_cljs_repl$make_repl_connect_file.invoke(boot_cljs_repl.clj:41)
    at adzerk.boot_cljs_repl$write_repl_connect_file.invokeStatic(boot_cljs_repl.clj:59)
    at adzerk.boot_cljs_repl$write_repl_connect_file.invoke(boot_cljs_repl.clj:54)
    at adzerk.boot_cljs_repl$repl_env$fn__359.invoke(boot_cljs_repl.clj:104)
    at weasel.repl.websocket$websocket_setup_env.invokeStatic(websocket.clj:72)
    at weasel.repl.websocket$websocket_setup_env.invoke(websocket.clj:60)
    at weasel.repl.websocket.WebsocketEnv._setup(websocket.clj:27)
    at boot.user.Delegatingweasel_repl_websocket_WebsocketEnv._setup(boot.user9006068267091739489.clj:120)
    at cljs.repl$repl_STAR_$fn__8620.invoke(repl.cljc:828)
    at cljs.compiler$with_core_cljs.invokeStatic(compiler.cljc:1152)
    at cljs.compiler$with_core_cljs.invoke(compiler.cljc:1143)
    at cljs.repl$repl_STAR_.invokeStatic(repl.cljc:825)
    at cljs.repl$repl_STAR_.invoke(repl.cljc:752)
    at cemerick.piggieback$run_cljs_repl.invokeStatic(piggieback.clj:169)
    at cemerick.piggieback$run_cljs_repl.invoke(piggieback.clj:155)
    at cemerick.piggieback$cljs_repl.invokeStatic(piggieback.clj:222)
    at cemerick.piggieback$cljs_repl.doInvoke(piggieback.clj:212)
    at clojure.lang.RestFn.invoke(RestFn.java:410)
    at clojure.lang.Var.invoke(Var.java:379)
    at adzerk.boot_cljs_repl$start_repl.invokeStatic(boot_cljs_repl.clj:120)
    at adzerk.boot_cljs_repl$start_repl.doInvoke(boot_cljs_repl.clj:107)
    at clojure.lang.RestFn.invoke(RestFn.java:397)
    at boot.user$eval15464.invokeStatic(boot.user9006068267091739489.clj:1)
    at boot.user$eval15464.invoke(boot.user9006068267091739489.clj:1)
    at clojure.lang.Compiler.eval(Compiler.java:6927)
    at clojure.lang.Compiler.eval(Compiler.java:6890)
    at clojure.core$eval.invokeStatic(core.clj:3105)
    at clojure.core$eval.invoke(core.clj:3101)
    at clojure.main$repl$read_eval_print__7408$fn__7411.invoke(main.clj:240)
    at clojure.main$repl$read_eval_print__7408.invoke(main.clj:240)
    at clojure.main$repl$fn__7417.invoke(main.clj:258)
    at clojure.main$repl.invokeStatic(main.clj:258)
    at clojure.main$repl.doInvoke(main.clj:174)
    at clojure.lang.RestFn.invoke(RestFn.java:1523)
    at clojure.tools.nrepl.middleware.interruptible_eval$evaluate$fn__1489.invoke(interruptible_eval.clj:87)
    at clojure.lang.AFn.applyToHelper(AFn.java:152)
    at clojure.lang.AFn.applyTo(AFn.java:144)
    at clojure.core$apply.invokeStatic(core.clj:646)
    at clojure.core$with_bindings_STAR_.invokeStatic(core.clj:1881)
    at clojure.core$with_bindings_STAR_.doInvoke(core.clj:1881)
    at clojure.lang.RestFn.invoke(RestFn.java:425)
    at clojure.tools.nrepl.middleware.interruptible_eval$evaluate.invokeStatic(interruptible_eval.clj:85)
    at clojure.tools.nrepl.middleware.interruptible_eval$evaluate.invoke(interruptible_eval.clj:55)
    at clojure.tools.nrepl.middleware.interruptible_eval$interruptible_eval$fn__1534$fn__1537.invoke(interruptible_eval.clj:222)
    at clojure.tools.nrepl.middleware.interruptible_eval$run_next$fn__1529.invoke(interruptible_eval.clj:190)
    at clojure.lang.AFn.run(AFn.java:22)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
boot.user=>

@samedhi
Copy link
Author

samedhi commented Feb 25, 2016

Shoot, yeah, I had export BOOT_EMIT_TARGET=no set in my .bash_profile | .bashrc

I don't think that is the issue though.

@Malabarba
Copy link
Member

Yeah, I still have the issue. Maybe weasel hassome external dependency?

@samedhi
Copy link
Author

samedhi commented Feb 25, 2016

https://github.com/samedhi/cljsreplerror

This is a project where the error occurs for me.

@arichiardi
Copy link
Contributor

I confirm that the error occurs for me in replumb as well, where I cannot evaluate (using C-c C-c) any form from a .cljs file in a Clojurescript REPL started with figwheel and (start-repl). Available for debugging 😉

@arichiardi
Copy link
Contributor

Oh I forgot to say that I am using either lein repl to start it or jack-in. The result is the same. Same thing if I jack-in for Clojure + Clojurescript repl.

coldnew added a commit to coldnew/coldnew-emacs that referenced this issue Mar 11, 2016
When playing with re-natal, I can't use C-x C-e to send latest sexp to
figwheel, cider will show something like:

    user-error: `cider-eval-last-sexp' needs a Clojure REPL.
    If you don't know what that means, you probably need to jack-in (`C-c M-j’).

After comment out my mode-alist setting in .emacs, this issue gone.

version:

  CIDER 0.12.0snapshot (package: 20160306.1636)
  [cider/cider-nrepl "0.12.0-SNAPSHOT"]

related issue:

  overtone/emacs-live#228
  clojure-emacs/cider-nrepl#301

Signed-off-by: Yen-Chin Lee <[email protected]>
@coldnew
Copy link

coldnew commented Mar 11, 2016

I also encounter this issue when playing re-natal with figwheel nrepl, after connect repl with cider, I can't use C-x C-e to evaluate latest sexp on clojurescript files.

I think this issue is related to overtone/emacs-live#228 , after comment out my auto-mode-alist setting for clj/cljs, this issue has gone.

Here's my quick fix: coldnew/coldnew-emacs@d490a26

Currently my .emacs setting doesn't has this issue after comment out auto-mode-alist setting.

Version info :
CIDER 0.12.0snapshot (package: 20160306.1636)
[cider/cider-nrepl "0.12.0-SNAPSHOT"]

@arichiardi
Copy link
Contributor

@coldnew you are right, see the linked commit in cider and also issue overtone/emacs-live#228 in emacs-live. There was a hard coded clojure-mode for cljs files

EDIT: sorry I see you have already solved it ;)

@samedhi
Copy link
Author

samedhi commented Mar 11, 2016

I rebuilt after reading this. The following workflow is fine now

BASH: boot development ;; starts boot development task
...
boot.user> (start-repl)
...
Connect my browser
...
I can now switch namespace into cljs code and do all my cider cljs evaling.

THAAAANK YOU!

I will let anyone else close it, but it has been resolved for me.

coldnew added a commit to coldnew/coldnew-emacs that referenced this issue Mar 12, 2016
Since clojure-mode already setup auto-mode-alist, we should set it
on-our-own, also note that setting this will cause cider connect nrepl
failed on cljs file.

see:
clojure-emacs/cider-nrepl#301

Signed-off-by: Yen-Chin Lee <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants