Fork me on GitHub

Hello, I'm trying out cljs+krell for react native development. I could finally run a simple app after some troubleshooting, and I can successfully run the repl from the command line (using the clj cli tool), but when I try to run the krell repl from cider I get this error:

Execution error (ExceptionInfo) at cljs.repl/evaluate-form (repl.cljc:577).
ReferenceError: Can't find variable: cljs
Does anyone have a clue about this error?


@laynor cider has a jack-in option for Krell. Is that what you are using?


Yes, that's right. I also tried with the "custom" jack in option and inserting

(do (require '[clojure.edn :as edn] 
         '[ :as io]
         '[krell.api :as krell]

    (def config (edn/read-string (slurp (io/file "build.edn"))))
    (krell/build config)
    (apply cider.piggieback/cljs-repl (krell.repl/repl-env) (mapcat identity config)))
when prompted for a form to start the repl


@U0ETXRFEW I can provide more detailed information - stack trace, edn files or even just push the whole thing on github if that is useful to understand the issue. It's just the hello krell app anyway.


I’m not a Cider user myself, but I use the same infrastructure (cider-nrepl, piggieback) and I could get the hello krell thing to work the other day. Maybe something has happened with Krell… I saw your questions and solution in the #cljsrn channel… Can you try with this sha for the Krell dep? c487f7c3a8ce1b3d74757d5a0af2a776f7704d94


@U0ETXRFEW Still having the same issue 😞 This is my deps.edn file:

{:deps {io.vouch/krell {:git/url ""
                        ;; :sha "a6bf860df2385384b36dea68bcf2e3163a14bfa8"}
                        :sha "c487f7c3a8ce1b3d74757d5a0af2a776f7704d94"}
        io.vouch/reagent-react-native {:git/url ""
                                       :sha "0fe1c600c9b81180f76b94ef6004c2f85e7d4aa0"}
        reagent/reagent {:mvn/version "1.0.0"
                         :exclusions [cljsjs/react cljsjs/react-dom]}}}


I see only two differences from mine. 1. I’m using this sha for reagent-react-native0fe1c600c9b81180f76b94ef6004c2f85e7d4aa0` 2. I’m using reagent 0.10.0


isn't the reagent-react-native sha the same?


oh, yes, I missread. So then only reagent.


tried changing reagent version but nothing changed 😕 this is the full exception stack trace:


I actually also tried to get your example running but I'm running into other issues (NPE when starting the repl from the command line, same issue as my project from cider)


Also, when I run the app on the android emulator, it stays stuck in the "Waiting for krell to load files" screen


Oh, that is a pretty old project. I'll update it. Good with the reminder.


Publish your project and I'll give it a spin.


So, no problems at all jacking in from Calva. What system/java/etcetera are you using?


Hey thanks for giving it a go! My system details: Os: Arch linux Emacs: recent version compiled from sources (master). native comp enabled Cider version: "CIDER 1.1.0 (package: 20210422.802) (Plovdiv)" clojure --version: Clojure CLI version


Output of java --version

θ60° [ale:~/src/krelltest] master(+7364/-6020) ± java -version
openjdk version "1.8.0_292"
OpenJDK Runtime Environment (build 1.8.0_292-b10)
OpenJDK 64-Bit Server VM (build 25.292-b10, mixed mode)


So, a bit newer Clojure CLI than I have (814). Let me see which java I use …


don't know if it's relevant, Nodejs version v16.1.0


Very hard to know what’s relevant. 😃 I use Java15 at the moment. Will try with Java 8. But first will try with latest clojure CLI.


I think java 15 doesn't work for android, that's the reason I'm using an older version 😞


You can try with Calva, so we can rule out that it is a CIDER problem.


No problems using 822 of clojure.


It seems I'm getting the same error with Calva: the repl shows this

clj꞉user꞉>  ; Use `alt+enter` to evaluate
; Creating cljs repl session...
; Connecting cljs repl: deps.edn + Krell...
;   The Calva Connection Log might have more connection progress information.
; Execution error (ExceptionInfo) at cljs.repl/evaluate-form (repl.cljc:577).
ReferenceError: Can't find variable: cljs


I thought it would. Now we know.


(by the way, what keybinding did you use to send the current form to the repl when you recorded?)


No problems with Java8 here.


Android works to, I tried by mistake. 😃


I have no easy way to try with newer nodejs. I depend on node a bit too heavily to dare. But I seriously also doubt that is the problem here.


what version are you on?


14 something. let me check…


~/Projects/tests/krelltest(master|✚2…) % node --version


> (by the way, what keybinding did you use to send the current form to the repl when you recorded?)




Run the command Fire up the Getting Started REPL to get a short primer on evaluating stuff in Calva. 😃


I'll try with your node version to see if sometihng changes ^^ Calva looks slick but switching from emacs is very very painful for me ahah


Will let you know how it goes, thanks for all the help so far!


@U0ETXRFEW It's working on emacs/cider with your node version!! 🥳 The other difference is that this node is installed in my home, while the former one was the system one - this might make a difference if some script tries to install something globally I guess. Strange thing - the calva repl hangs waiting the cljs repl for some reason (it stays stuck at the java repl). Don't know what's wrong - I tried switching clj/cljs from the command palette but I may just have done something wrong.


Is the app running in the simulator?


I don't think anything is installed globally by any script.


Yes, in the simulator


I still haven't tried on my phone


It was running that I was curious about*.* 😎


ahah I see ^^


the app was running at the beginning too - but no luck with cider


btw, I wanted to understand about the node thing - so I installed v16.1.0 with nvm and got the same issue as before. So I went back to v14.3.0, but now I got the bug on v14.3.0 too @.@


;_; still no way out


Tried cleaning away .cpcache and target?


i hadn't thought of cpcache! let me try


no luck 😞


Do you get a stacktrace somewhere?


yes, in the cider debugger


this one


Post about this in the #nrepl channel. Maybe someone there has a clue given what we have tested and that stacktrace.


Thanks, will do ^^


strangest stuff - I have a copy of the same project (after I pushed, i recloned the repo I shared with you to test it before giving you the url) and if I run npx react-native start and npx react-native run-android in the newer clone, but then jack in from the old project, I get a half working repl (I reach the cljs.user => prompt and can for example open an alert window on the app, but I get other errors in the repl (cljs.pprint.pprint related).


Is it fine if I mention you to say the project works at least on your machine?


Yes, please do.


Done, thanks 🙂


Do you have better luck with shadow-cljs, maybe? Could be worth a try, unless you have specific reasons to use Krell.


I had success only with shadow-cljs + expo (with your template ahaha)


but I often had to clear the expo app data and restart things due to some weird errors (that now I can't really remember well)


having so many layers disturbs me a bit because the amount of things that I don't understand increases


before trying krell I tried setting up a shadow-cljs + reagent project but can't really remember what went wrong


@U0ETXRFEW just to let you know, I finally opened an issue on krell's github - I tried some old versions and finally I got one of them working (last commit Feb 25) - it appears the issue is triggered by some relatively recent changes in krell itself.


Ah, thanks for updating.


you are welcome, thanks for all the help ^_^


@qmstuart evaluating (run-tests) should work. And as @emilaasa suggests, using Calva custom REPL commands for it can sweeten up the workflow. But first the evaluation must work of course… If you can create a minimal repro project that we can clone, I can give it a spin and see what I can figure out.

Dave Suico14:05:16

Hi guys I'm using VS Code and Calva and I have this task where I need to get a value from my win 10 environment using System/getenv, it works in first try but when I updated the value and then call getenv again it doesn't return the updated value. Is there anyway I could get the new value without having to restart my PC?

R.A. Porter14:05:59

System variables are set in the shell when it starts; the process reads those. If you want the Clojure process to reflect an updated environment variable, you need to call System/setenv in the same process.

❤️ 3

You can't set the environment of a child process when it is started. I think only Plan 9 supports that. But neither should a system restart be necessary. Restarting the REPL from where you have changed the environment variable is enough. If you are using Calva Jack-in you can use the jackInEnv setting and then just jack-in again, which will restart the REPL with the variables you have set in the setting.


What does this ^:keyword notation mean, eg. (defn ^:export init ...)?


@oliver.heck That is shorthand for ^{:export true} which is metadata added to the symbol (or more generally expression) that follows it.


See specifically (but that whole page in general)

👍 3

So this is probably some hint to the compiler? :thinking_face:


It is a cljs thing


The assumption in cljs is that you will be passing the output through the google closure compiler, with will mangle all the names


Marking for export let's google closure know you want to be able to refer to that name from some external code

👍 6

Hi. I am currently going through Web development in clojure and learning Luminus. I want to migrate my H2 db to add a column. The problem: Since I had SQL Exception, I get the "Migration reserved by another instance" message. What would be your quickest way to edit the schema_migrations table in my database, like it says here? Should I get the H2 Console app or is it an easier way?


Got the file opened in DbVisualizer, found the schema_migration table but there is no row that has id of -1 and Drop table is a pro feature.. EDIT: Managed to drop the migration table with a script.. seems like I fixed the issue. I would never do this in production or anything, seems like a pretty nasty bug?


Alternatively, can anyone suggest a library to work with PostgreSQL asynchronously?