Fork me on GitHub
Ian Fernandez02:09:28

guys, how can I use cider with shadow-cljs node-repl?

Ian Fernandez02:09:50

I'm having some problems on the repl recognizing deps

Ian Fernandez03:09:39

that was related to this

Ian Fernandez02:09:49


{:deps         true
 :builds       {:cloud-function {:target           :node-library
                                 :output-to        "index.js"
                                 :compiler-options {:optimizations :simple}
                :test      {:target    :node-test
                            :output-to "target/firstfunction.firstfunction.js"
                            :compiler-options {:optimizations :simple}
                            :autorun   true}

Ian Fernandez02:09:27


{:paths ["resources" "src"]
 :deps  {org.clojure/clojure            {:mvn/version "1.10.1"}
         org.clojure/clojurescript      {:mvn/version "1.10.520"}
         org.clojure/core.async         {:mvn/version "0.4.500"}
         org.clojure/tools.logging      {:mvn/version "0.5.0"}
         ch.qos.logback/logback-classic {:mvn/version "1.2.3"}

         tick                                {:mvn/version "0.4.17-alpha"}
         com.lucasbradstreet/cljs-uuid-utils {:mvn/version "1.0.2"}
         cljs-bean                           {:mvn/version "1.3.0"}
         thheller/shadow-cljs                {:mvn/version "2.8.51"}
         funcool/promesa                     {:mvn/version "2.0.1"}}
 :aliases {:test                 {:extra-paths ["test"]
                                  :extra-deps  {org.clojure/test.check {:mvn/version "0.10.0-RC1"}}}
                                  :main-opts  ["-m" "cognitect.test-runner" "-d" "test"]}
           :build-cloud-function {:main-opts ["-m" "shadow.cljs.devtools.cli" "compile" "cloud-function"]}}}

Ian Fernandez02:09:46

when I try

M-x cider-jack-in-cljs
using shadow-cljs it gives me:
error in process sentinel: nrepl-server-sentinel: Could not start nREPL server: env: node: No such file or directory

Ian Fernandez02:09:25

I've added on emacs path the nvm path

Ian Fernandez03:09:22

and when I connect from an external repl initialized on a terminal I can't require mine dependencies


What command do you run from a repl and what error message or behavior do you observe when you connect

Ian Fernandez03:09:43

[nREPL] Starting server via /home/ianffcs/.nvm/versions/node/v12.10.0/bin/npx shadow-cljs -d nrepl:0.6.0 -d cider/piggieback:0.4.1 -d refactor-nrepl:2.5.0-SNAPSHOT -d cider/cider-nrepl:0.22.0-beta8 -d nubank/midje-nrepl:1.2.0-SNAPSHOT server error in process sentinel: nrepl-server-sentinel: Could not start nREPL server: /usr/bin/env: “node”: unexistent directory or archive error in process sentinel: Could not start nREPL server: /usr/bin/env: “node”: unexistent directory or archive


i'm heading to bed so most likely culprits: 1. when starting from the repl. you aren't including the necessary cider-nrepl middleware. Do another jack-in-cljs and see the startup command used (it can be found in *Messages*) and connect to a shadow started from the terminal with that same startup command 2. you still don't have npx on the exec-path for emacs. try running (shell-command-to-string "which npx"). If it returns nil or some kind of message saying no command is found, you need to keep going. I used to use nvm but it didn't play nicely with emacs so i switched to a more traditional installation method

Ian Fernandez03:09:32

this are in messages buffer


can you run node in your terminal?


i think i ran into this with a custom installation directory and shadow expects node to be at /usr/bin/env. Not sure. that's just guess and hazy recollectoin

Ian Fernandez03:09:23

$which node
gives me

Ian Fernandez03:09:40


Ian Fernandez03:09:59

maybe I'll make some symbolic links on bin?


and can you run npx shadow-cljs?

Ian Fernandez03:09:22

my symbolic links worked

Ian Fernandez03:09:50

kinda sad if I have to upgrade nvm

Ian Fernandez03:09:02

Syntax error (FileNotFoundException) compiling at (src/firstfunction/firstfunction/foo.cljs:1:1).
Could not locate cljs_bean/core__init.class, cljs_bean/core.clj or cljs_bean/core.cljc on classpath. Please check that namespaces with dashes use underscores in the Clojure file name.

Ian Fernandez03:09:20

now it's giving this when I try to load the namespace


no idea. do you require cljs-bean anywhere?


or is that some transitive dep?

Ian Fernandez03:09:58

     [cljs-bean.core :refer [bean ->clj ->js]]))


and did you add that dep?


is that a clj or cljs file?


weird that its saying its looking for .class, clj, or cljc files

Ian Fernandez03:09:42

I rerun the repl and it's like these now


ask in #shadow-cljs i think there may have been a bug with the node-* repls


its saying its not connected to an app there

Ian Fernandez03:09:55

also, when I load the buffer

Ian Fernandez03:09:01

it's eternal loading =<


it can't load. you still have a clj repl. it hasn't connected to the js runtime


which explains the reason why its trying to load cljs bean as a clj lib

Ian Fernandez03:09:06

yeah, I thought it would be something like this

Ian Fernandez03:09:29

I'll try to load that stuff on IntelliJ for now =<

Ian Fernandez04:09:36 => We need to run that JavaScript file in the node runtime in order to get to our REPL, therefore we run in a terminal ...


Is there a way to disable suitable?


It breaks for me with the latest snapshot (I'm using CIDER with shadow-cljs)


@malch Currently that’s not possible, but if you submit a bug report probably @robertkrahn is going to address it pretty quickly.


Making it possible to disable suitable is in our todo list.


Ok, thanks! Will do it later today