cljsrn

https://github.com/drapanjanas/re-natal | https://github.com/drapanjanas/re-natal/wiki/FAQ | https://github.com/condense/mercury-app/wiki | https://github.com/seantempesta/expo-cljs-template/ https://www.npmjs.com/package/create-expo-cljs-app
Oliver George 2021-05-10T00:11:26.235700Z

Stand down red alert. Clearly my env variables didn't make it to the node invocation. This worked...

Oliver George 2021-05-10T00:11:29.235800Z

Oliver George 2021-05-10T00:12:39.236100Z

This put me on to it: https://github.com/facebook/react-native/issues/22021

raspasov 2021-05-10T00:46:07.237600Z

Yup… That has tripped me before.

dnolen 2021-05-10T13:25:38.239400Z

@laynor those look like tools deps problems?

dnolen 2021-05-10T13:25:46.239800Z

I don't see how Krell is involved in that trace

dnolen 2021-05-10T13:26:02.240100Z

I would delete .cpcache and ~/.gitlibs and try again

dnolen 2021-05-10T13:27:20.241100Z

if it persists I think probably need to ask in #tools-deps on how to debug

Ale 2021-05-10T13:28:53.241300Z

I already deleted everything - actually I had a friend install the tools from scratch (not a clojure user), and he had the same result. I myself tried to reinstall every tool (java, node, clojure etc) starting from a newly created user on my machine. I'm installing node with nvm, android studio, sdk and clojure on the home directory, so the only shared dependency is (to my knowledge) java.

Ale 2021-05-10T13:29:30.241500Z

reverting to an older krell version fixed the issue, as outlined in the bug report

Ale 2021-05-10T13:33:21.241700Z

I'm not saying the problem is not in the tools - just that the previous krell version did not trigger the issue

dnolen 2021-05-10T13:35:29.242400Z

@laynor we're using shas close to master on two projects and I haven't seen this one

dnolen 2021-05-10T13:35:45.242900Z

I don't think anything else on your system matters - the failure is from tools-deps

dnolen 2021-05-10T13:35:55.243400Z

the blame can't be on Node, or Java, or Clojure or anything else

dnolen 2021-05-10T13:36:22.243800Z

it's true, it could be in Krell, I'll try the tutorial now and see what happens

Ale 2021-05-10T13:38:06.245700Z

@dnolen the same project worked worked correctly on @pez machine - from an outsider point of view, it looks like it's dependent on the particular os I'm using, which is the same of the friend's machine on which I replicated the issue

dnolen 2021-05-10T13:38:18.246100Z

Linux?

Ale 2021-05-10T13:38:32.246400Z

Yes

Ale 2021-05-10T13:39:10.246800Z

In particular, an up to date Arch linux machine

Ale 2021-05-10T13:39:50.247400Z

Arch is quite quick with releasing updates so it might be triggered by some "new" package version

Ale 2021-05-10T13:40:08.247700Z

I honestly have no clue aside from observing the behavior

Ale 2021-05-10T13:47:14.249200Z

I can bisect to reach the problematic commit - what directories would you suggest to delete at each try? @dnolen would .cpcache target ~/.gitlibs be enough?

dnolen 2021-05-10T13:48:10.249500Z

yes

dnolen 2021-05-10T13:48:16.249900Z

tools-deps still has caching / sha fetch bugs from what I can tell

dnolen 2021-05-10T13:48:30.250400Z

I hit some on M1 and had to switch to dev version

dnolen 2021-05-10T13:48:47.251100Z

but even on non-M1 Apple hardware I occasionally hit null-pointer exceptions when constructing the classpath

Ale 2021-05-10T13:50:24.252400Z

I see - I haven't seen NPEs, but I can switch to the dev version if that can help in some way - just don't really know how

Ale 2021-05-10T13:50:43.252900Z

I'm very much a beginner with clojure, just played long ago

Ale 2021-05-10T13:51:07.253200Z

I'll start bisecting and let you know

dnolen 2021-05-10T13:52:53.253900Z

Error building classpath. Cannot invoke "java.io.File.isAbsolute()" because "f" is null
java.lang.NullPointerException: Cannot invoke "java.io.File.isAbsolute()" because "f" is null

dnolen 2021-05-10T13:53:01.254300Z

@laynor that is from your bug report above

dnolen 2021-05-10T13:53:04.254500Z

that is an NPE

Ale 2021-05-10T13:53:11.254800Z

uh, you're right

Ale 2021-05-10T13:53:42.255500Z

I was thinking about the topmost exception and forgot about the inner one, sorry

dnolen 2021-05-10T13:54:22.255700Z

re: Cider this one is more annoying

dnolen 2021-05-10T13:55:05.256200Z

but I think I see the problem

Ale 2021-05-10T13:56:17.256500Z

oh, but wait - that one I solved

Ale 2021-05-10T13:56:26.256900Z

that's not the issue I'm talking about

Ale 2021-05-10T13:56:38.257400Z

this is it

Ale 2021-05-10T13:57:13.258200Z

I was just checking the stack trace to see if I had actually forgotten the NPE - but I don't see any in the stack trace in my bug report on GH.

Ale 2021-05-10T13:59:03.259800Z

the NPE I reported here on the channel was due to some problem with the git SHAs that I copied from the tutorial or from the readme itself.

Ale 2021-05-10T14:00:44.260500Z

the tutorial references

io.vouch/reagent-react-native {:git/url "<https://github.com/vouch-opensource/reagent-react-native.git>"
                                       :sha "0d25830bd0bf02baf272b9c60d3edefc6766ef24"}

Ale 2021-05-10T14:01:00.260800Z

but I do not see that hash here https://github.com/vouch-opensource/reagent-react-native/commits/master

dnolen 2021-05-10T14:01:36.261300Z

oh

Ale 2021-05-10T14:01:59.261800Z

so I went on and used the latest hashes for both krell and reagent-react-native

Ale 2021-05-10T14:02:26.262200Z

and finally got the error that I reported on the GH issue

dnolen 2021-05-10T14:02:58.262500Z

erg sorry yeah fixed it up

dnolen 2021-05-10T14:03:01.262700Z

thanks

Ale 2021-05-10T14:03:09.263Z

NP

Ale 2021-05-10T14:03:36.263500Z

😉

Ale 2021-05-10T14:05:13.263900Z

I must say, it was a very confusing error for a non-existent hash

dnolen 2021-05-10T14:07:12.264600Z

the Cider thing is a bit less clear to me

dnolen 2021-05-10T14:07:30.265100Z

what happens is that Krell does not even try to connect until cljs.core is loaded to avoid this kind of issue

dnolen 2021-05-10T14:08:08.265900Z

So Krell startup is blocked, and thus Cider startup is blocked until the RN environment connects (which is after cljs.core is available)

dnolen 2021-05-10T14:08:37.266600Z

so at least at first glance I cannot understand it since this is the exact same bug I had to fix for cljs.main style interaction

dnolen 2021-05-10T14:10:28.267600Z

@laynor so in the Metro terminal do you see "Connected to Krell REPL Server"

Ale 2021-05-10T14:14:53.268600Z

I was just setting up a script to automate the cleaning/building etc to let you know, as if I remember correclty, I do see it

Ale 2021-05-10T14:20:18.269400Z

@dnolen this is from the output of npx react-native start

LOG  Running "Dondai" with {"rootTag":11}
 LOG  Connected to Krell REPL Server
 ERROR  Could not evaluate form: (cljs.core._STAR_print_namespace_maps_STAR_ = true) [ReferenceError: Can't find variable: cljs]

Ale 2021-05-10T14:22:47.269500Z

I was watching the commit introducing these lines yesterday, as it was the most suspect from an outsider point of view, but going back did not solve the issue as you might suspect. I might not have cleaned everything properly at the time though.

dnolen 2021-05-10T14:59:49.269900Z

@laynor what happens when you refresh Metro?

Ale 2021-05-10T15:03:41.270400Z

the repl stays stuck, and the "Could not evaluate form: ..." line is not printed

Ale 2021-05-10T15:05:46.270800Z

if i try reconnecting, the same error is raised

dnolen 2021-05-10T15:16:06.271300Z

this could very well be a Cider issue - sounds pretty weird

dnolen 2021-05-10T15:17:02.271500Z

or Cider/Piggieback issue

dnolen 2021-05-10T15:19:41.272100Z

@laynor I don't use Cider and not super interested in spending time figuring out Cider/Piggie specific prbolems

dnolen 2021-05-10T15:19:54.272600Z

too much time wasted w/ that stuff for me to ever look at it again

dnolen 2021-05-10T15:19:57.272800Z

but

dnolen 2021-05-10T15:20:05.273Z

debugging Krell is trivial

dnolen 2021-05-10T15:20:26.273400Z

you can edit krell_repl.js and drop some console.logs

dnolen 2021-05-10T15:20:47.273900Z

don't ClojureScript compile/recompile, just start the app and try to connect the REPL

dnolen 2021-05-10T15:20:52.274200Z

and you should see your logging

dnolen 2021-05-10T15:21:13.274700Z

the situation you're describing seems impossible but maybe a bit more logging when the REPL connects will clarify something

Ale 2021-05-10T15:23:52.275300Z

I'll try to investigate and let you know - I'm now bisecting

Ale 2021-05-10T15:24:15.275800Z

a bit of a long process because of issues with react-native-tcp-socket

dnolen 2021-05-10T15:24:43.276300Z

@laynor one thing is why you need Cider though - are you using Calva?

dnolen 2021-05-10T15:25:03.276800Z

if you're not using Calva and you're doing ClojureScript there's is no benefit

dnolen 2021-05-10T15:25:16.277100Z

and really Calva should support standard REPLs

dnolen 2021-05-10T15:25:26.277400Z

tooling that starts w/ nREPL is fundamentally broken in IMO

Ale 2021-05-10T15:26:03.277700Z

I tried both - and same issue in both of them

Ale 2021-05-10T15:26:23.277900Z

I'm using emacs

Ale 2021-05-10T15:27:06.278500Z

but lsp is kinda broken (missing docs, cannot jump on some functions) so I'm using cider

dnolen 2021-05-10T15:28:54.279200Z

@laynor hrm I'm very skeptical about cljs.main issues

dnolen 2021-05-10T15:29:06.279500Z

did you try outside of the editor a la tutorial?

Ale 2021-05-10T15:29:19.279800Z

you mean the repl? it works flawlessly

dnolen 2021-05-10T15:31:22.280100Z

ah k Emacs - sorry right other reason to Cider

dnolen 2021-05-10T15:31:45.280400Z

yeah I would put a little a bit of debugging to see

dnolen 2021-05-10T15:31:59.280800Z

I just don't see how Cider could connect and then cljs fail to evail

Ale 2021-05-10T15:33:07.282300Z

I have 1/10th the clues you have 😆 Are you using jetbrains' stuff?

dnolen 2021-05-10T15:33:19.282600Z

edit

Ale 2021-05-10T15:34:12.283Z

edit?

dnolen 2021-05-10T15:37:27.283200Z

target/krell_repl.js like I said

dnolen 2021-05-10T15:37:33.283400Z

if you don't compile then this file is not touched

dnolen 2021-05-10T15:37:37.283600Z

this is how I debug Krell

dnolen 2021-05-10T15:37:53.283900Z

those lines I linked to in the source above would give you all the info

dnolen 2021-05-10T15:38:04.284200Z

i.e. how can cljs.core not be available

dnolen 2021-05-10T15:38:20.284600Z

you can add more console.log s right there

dnolen 2021-05-10T15:39:06.285300Z

@laynor re: what I use - anything that let's me use cljs.main approach - I use IntelliJ, but I also use the shell

dnolen 2021-05-10T15:39:29.285900Z

when I was in Emacs I switched to clj-inf to avoid the issues

Ale 2021-05-10T15:41:15.287200Z

I see - I'm not very well versed- very much a beginner - so I don't really know about the different approaches out there. I'll try to look into it.

Ale 2021-05-10T15:44:41.289Z

anyway, fwiw, the issue appears somewhere from d0e1153 to d0e1153, with 6154649 still giving me a mostly working cljs prompt but riddled with errors (http://goog.xyz already declared, I've seen some related fixes in the git log)

dnolen 2021-05-10T15:46:42.289400Z

@laynor one dummy check

dnolen 2021-05-10T15:46:56.289800Z

your target/krell_repl.js must look like exactly the one in master

dnolen 2021-05-10T15:46:59.290Z

if it doesn't - not going to work

dnolen 2021-05-10T15:47:23.290400Z

basically I'm saying the behavior you are seeing simply doesn't not seem possible

dnolen 2021-05-10T15:47:28.290600Z

so check some assumptions

Ale 2021-05-10T15:51:07.291300Z

shall I use krell's master version and double check target/krell_repl.js?

dnolen 2021-05-10T15:54:12.291600Z

I mean compare your not working thing w/ master

dnolen 2021-05-10T15:54:30.292200Z

if your krell_repl.js does not look like master then your bug report makes perfect sense

dnolen 2021-05-10T15:54:39.292500Z

because that was fixed

dnolen 2021-05-10T15:55:17.292800Z

and if it's not fixed version for you locally - then it cannot work

Ale 2021-05-10T15:56:33.293100Z

this is the diff:

[ale:~/src/krelltest] master(+1792/-15603)* ± diff repl_tmp.js target/krell_repl.js
15,16c15,16                                           
&lt; var SERVER_IP = "$KRELL_SERVER_IP";                 
&lt; var SERVER_PORT = krellPortMap ? krellPortMap[DeviceInfo.getDeviceId()] || $KRELL_SERVER_PORT : $KRELL_SERVER_PORT;
---                                                   
&gt; var SERVER_IP = "192.168.11.14";                    
&gt; var SERVER_PORT = krellPortMap ? krellPortMap[DeviceInfo.getDeviceId()] || 5001 : 5001;
18c18                                                 
&lt; const KRELL_VERBOSE = $KRELL_VERBOSE;               
---                                  
&gt; const KRELL_VERBOSE = false;            
[ale:~/src/krelltest] master(+1792/-15603)* 1 ± npx react-native start

Ale 2021-05-10T15:57:47.293600Z

issue as detailed on github - LOG Running "Dondai" with {"rootTag":11} LOG Krell sez howdy, Device ID: goldfish_x86 LOG Connected to Krell REPL Server ERROR Could not evaluate form: (cljs.core.STARprint_namespace_maps_STAR_ = true) [ReferenceError: Can't find variable: cljs]

dnolen 2021-05-10T16:05:39.294900Z

can you enumerate the Android platform details you're trying this with

Ale 2021-05-10T16:07:54.295400Z

Installed packages:=====================] 100% Computing updates...             
  Path                                     | Version      | Description                             | Location                                 
  -------                                  | -------      | -------                                 | -------                                  
  build-tools;29.0.2                       | 29.0.2       | Android SDK Build-Tools 29.0.2          | build-tools/29.0.2/                      
  build-tools;30.0.3                       | 30.0.3       | Android SDK Build-Tools 30.0.3          | build-tools/30.0.3/                      
  emulator                                 | 30.6.5       | Android Emulator                        | emulator/                                
  ndk;22.1.7171670                         | 22.1.7171670 | NDK (Side by side) 22.1.7171670         | ndk/22.1.7171670/                        
  patcher;v4                               | 1            | SDK Patch Applier v4                    | patcher/v4/                              
  platform-tools                           | 31.0.2       | Android SDK Platform-Tools              | platform-tools/                          
  platforms;android-29                     | 5            | Android SDK Platform 29                 | platforms/android-29/                    
  platforms;android-30                     | 3            | Android SDK Platform 30                 | platforms/android-30/                    
  sources;android-30                       | 1            | Sources for Android 30                  | sources/android-30/                      
  system-images;android-30;google_apis;x86 | 9            | Google APIs Intel x86 Atom System Image | system-images/android-30/google_apis/x86/

Ale 2021-05-10T16:10:09.295800Z

avd is on api 30

dnolen 2021-05-10T16:10:14.296100Z

@laynor ok looks ok, which actual emulator? Pixel 3/4?

Ale 2021-05-10T16:10:30.296300Z

pixel 3a

dnolen 2021-05-10T16:11:01.297Z

you're not trying to use Hermes or doing anything like that right?

Ale 2021-05-10T16:11:05.297100Z

the default one android studio installs - I removed my old android studio install

Ale 2021-05-10T16:11:23.297600Z

never even heard about it

dnolen 2021-05-10T16:11:26.297800Z

good

dnolen 2021-05-10T16:12:52.299Z

finally you get no ERROR s about file failing to load?

Ale 2021-05-10T16:12:57.299300Z

TBH, before krell I was playing with shadow-cljs/expo but was encountering repl disconnects and other weird errors so I wanted to switch to krell to make the stack a bit less deep

dnolen 2021-05-10T16:13:06.299700Z

that would be only other reason cljs.core didn't appear

dnolen 2021-05-10T16:13:20.300400Z

because something failed to load before it failing everyone after it

Ale 2021-05-10T16:13:47.300800Z

where would I see these errors?

dnolen 2021-05-10T16:13:51.301Z

in Metro

dnolen 2021-05-10T16:13:54.301200Z

as ERROR ...

Ale 2021-05-10T16:14:25.301500Z

no other errors

dnolen 2021-05-10T16:14:38.301800Z

and this is with the tutorial?

Ale 2021-05-10T16:14:44.302200Z

yup

dnolen 2021-05-10T16:14:50.302400Z

I can try on Android now that we've narrow it down

Ale 2021-05-10T16:15:23.303100Z

you can even try my project, I posted the url on github - It'll most likely just work for you as it did for @pez

Ale 2021-05-10T16:15:33.303300Z

I mean on the github issue

Ale 2021-05-10T16:15:49.303700Z

it's just the krell hello world, nothing fancy

Ale 2021-05-10T16:16:26.304800Z

it's probably referencing some older version because at that time I tried to make the version of every package coincide with the ones @pez was using.

pez 2021-05-10T16:17:03.305400Z

Yeah. Works like a charm on my Mac. Very strange.

dnolen 2021-05-10T16:19:26.305900Z

@laynor this could be Android / Linux problem I'm trying to think about why ...

dnolen 2021-05-10T16:19:42.306100Z

@laynor while I'm poking at this try Pixel4

Ale 2021-05-10T16:24:42.306400Z

@dnolen api level 30 ok? (android R)

dnolen 2021-05-10T16:26:18.306700Z

yes

dnolen 2021-05-10T16:27:11.307700Z

I mean Android version is mostly important for compatibility with react-native-tcp-socket - for the REPL part

dnolen 2021-05-10T16:27:31.308300Z

but Krell now longer requires a REPL to function - so support for various Android devices is much wider now

dnolen 2021-05-10T16:27:56.308600Z

but 30 should be OK for REPL that's what I'm using

Ale 2021-05-10T16:28:10.308800Z

alright, it's installing

dnolen 2021-05-10T16:32:03.309300Z

fwiw, on OS X I'm testing Pixel 3 API 30 right now

Ale 2021-05-10T16:33:56.309900Z

no luck for me with pixel 4 - I'm kinda confident it'll work for you though

dnolen 2021-05-10T16:38:19.310200Z

Krell was able to build the app - now verifying REPL connect

dnolen 2021-05-10T16:38:44.310500Z

yeah all works

Ale 2021-05-10T16:39:03.310800Z

appears to be linux-specific, doesn't it

dnolen 2021-05-10T16:40:09.311800Z

@laynor do you have Android device?

Ale 2021-05-10T16:40:16.312300Z

real device? yup

dnolen 2021-05-10T16:40:20.312400Z

that would eliminate Linux environmnet oddities

dnolen 2021-05-10T16:40:59.312900Z

npx react-native run-android but w/ your device connected

Ale 2021-05-10T16:41:44.313800Z

lemme grab a cable, last test before going to bed, it's almost 2am here ^^;

Ale 2021-05-10T16:54:58.314Z

@dnolen same issue with the physical device

Ale 2021-05-10T17:03:00.314900Z

btw, when I add logs and try to reconnect with cider, my krell_repl.js is overwritten

Ale 2021-05-10T17:04:06.315600Z

the app appears to be recompiling or something

Ale 2021-05-10T17:08:19.317Z

this may sound ridiculous but still - I removed write permissions from the krell_repl.js file, tried to reconnect, got this error on the repl

nil#'user/configExecution error (FileNotFoundException) at java.io.FileOutputStream/open0 (FileOutputStream.java:-2).
target/krell_repl.js (Permission denied)
no errors in the metro terminal, and a working cljs repl

Ale 2021-05-10T17:10:45.317700Z

there must be something wrong re. the automatic rebuild on repl connection

dnolen 2021-05-10T17:11:07.317900Z

hrm, let's pick it up tomorrow

dnolen 2021-05-10T17:11:20.318400Z

if you're not manually recompiling krell_repl.js should not be overwritten

dnolen 2021-05-10T17:11:44.319Z

so Cider/Piggie could very well be doing something very yucky

dnolen 2021-05-10T17:11:48.319300Z

which is messing everything up

dnolen 2021-05-10T17:11:50.319600Z

would not be first time

dnolen 2021-05-10T17:12:00.319900Z

oh but this still plain REPL, nvm?

dnolen 2021-05-10T17:12:10.320300Z

oh Cider ..

dnolen 2021-05-10T17:12:11.320500Z

argh

dnolen 2021-05-10T17:12:24.321100Z

let's keep Cider out of this please until we can isolate 🙂

dnolen 2021-05-10T17:12:32.321400Z

unless you said above that plain REPL always works

Ale 2021-05-10T17:12:37.321700Z

the plain repl (as in clj -M ... -r) works flawlessly, as I said before

dnolen 2021-05-10T17:12:40.322Z

oh ok

dnolen 2021-05-10T17:12:44.322300Z

OK

Ale 2021-05-10T17:12:45.322500Z

the issue arises just with calva/cider

dnolen 2021-05-10T17:12:51.322700Z

so then this might be it

dnolen 2021-05-10T17:12:57.323100Z

Cider/Piggie may be doing something horrible

Ale 2021-05-10T17:13:08.323400Z

but only on the newer krell versions for some reasons

dnolen 2021-05-10T17:13:25.323700Z

well because newer Krell is the right way

dnolen 2021-05-10T17:13:29.323900Z

everything before was in fact broken

dnolen 2021-05-10T17:13:33.324100Z

the new Krell has no issues

dnolen 2021-05-10T17:13:41.324400Z

you never even need to restart the damn thing once you start the REPL once

dnolen 2021-05-10T17:13:44.324600Z

it never hangs

dnolen 2021-05-10T17:13:51.324800Z

it always flawless reconnects

dnolen 2021-05-10T17:14:01.325100Z

it survivs RN refresh

dnolen 2021-05-10T17:14:06.325300Z

app re-install

dnolen 2021-05-10T17:14:16.325600Z

all possible scenarios and the REPL never needs to be restarted

dnolen 2021-05-10T17:14:29.325900Z

so the fact that Cider worked before isn't important

dnolen 2021-05-10T17:14:39.326200Z

Cider was broken and Krell were broken together

dnolen 2021-05-10T17:14:53.326800Z

now Krell works - but Cider is doing something strange

Ale 2021-05-10T17:15:02.327Z

all the niceties after d0e115309580ca0bdc782e4ca396df66a357d212 then?

Ale 2021-05-10T17:15:04.327200Z

ahah

dnolen 2021-05-10T17:15:32.328Z

yes once I changed Krell to always a produce a working RN app and to reuse Metro / fetch

Ale 2021-05-10T17:15:32.328300Z

I see - so we have a test case for the cider/piggie guys?

dnolen 2021-05-10T17:15:56.328900Z

all the crazy bugs went away - iOS worked, Android works - and a dev can work even if they don't use a REPL

dnolen 2021-05-10T17:16:07.329100Z

fewer deps, etc. etc.

Ale 2021-05-10T17:17:02.330400Z

I'd really like the two to go well together, cider is pretty handy and well integrated in emacs

dnolen 2021-05-10T17:17:27.330700Z

@laynor it's possible - tomorrow we can try it verbose mode and you can probably see that Cider forces a recompile somehow

Ale 2021-05-10T17:17:41.331200Z

probably there's a way to stop it

dnolen 2021-05-10T17:17:46.331400Z

yes

Ale 2021-05-10T17:19:34.332100Z

let's take a look tomorrow then, thanks for the help today :)

dnolen 2021-05-10T17:19:49.332300Z

np