BetterThanTomorrow / calva

Clojure & ClojureScript Interactive Programming for VS Code
https://marketplace.visualstudio.com/items?itemName=betterthantomorrow.calva
Other
1.58k stars 212 forks source link

v2.0.210: Jack-In with fixed `deps.edn + shadow-cljs` fails starting cljs REPL #1285

Open real-iceman opened 2 years ago

real-iceman commented 2 years ago

I'm trying to use the recently re-added jack-in configuration deps.edn + shadow.-cljs. This fails with message

Failed starting cljs repl for build: :workspaces. Is the build running and connected?,

unfortunately withount any hint in the Calva Connection Log (sometimes I get Socket closed). CLJ REPL is active, but no CLJS REPL has been started.

Configuration shadow-cljs seems to work fine and starts cljs REPL as expected.

I'm using VSCode 1.59.1 Windows 10 / WSL2. Already deactivated all other extensions. Also tried a fresh VSCode + Calva install in a Linux VM, but same result.

Problem can be reproduced using fulcro-template:

git clone https://github.com/fulcrologic/fulcro-template
cd fulcro-template
yarn install

Then, open folder in VSCode and jack-in using configuration deps.edn + shadow-cljs, alias :dev and build :workspaces.

Maybe I'm just doing it wrong as I am quite new to Clojurescript and Calva? Which, btw, seems to be a great extension!

bpringe commented 2 years ago

@real-iceman Thanks for the report and reproduction steps.

Pinging @PEZ.

PEZ commented 2 years ago

@real-iceman does it work without the :workspaces build? (Not suggesting you should be running without it, rather trying to figure out where things go wrong.)

real-iceman commented 2 years ago

@PEZ Thanks for replying so quickly!

I tried also :main build, but unfortunately it's the same result.

Is there a way to trace what happens behind the scenes?

bpringe commented 2 years ago

@real-iceman You can check the developer tools console for any errors. Help -> Toggle Developer Tools -> Console

real-iceman commented 2 years ago

@bpringe In the devtools console I can see two errors and a warning at VSCode startup, but no new messages from the jack-in process.

grafik

bpringe commented 2 years ago

I tried to follow the quick start in the project readme and when I run npx shadow-cljs server I get the following error:

shadow-cljs - config: /Users/brandon/development/fulcro-template/shadow-cljs.edn
shadow-cljs - starting via "clojure"
WARNING: Implicit use of clojure.main with options is deprecated, use -M
Execution error (UnsatisfiedLinkError) at java.lang.ClassLoader$NativeLibrary/load0 (ClassLoader.java:-2).
/private/var/folders/9g/s52593k52h7g6r6jc54g_p7m0000gn/T/jna16528589360030829895.tmp: dlopen(/private/var/folders/9g/s52593k52h7g6r6jc54g_p7m0000gn/T/jna16528589360030829895.tmp, 1): no suitable image found.  Did find:
        /private/var/folders/9g/s52593k52h7g6r6jc54g_p7m0000gn/T/jna16528589360030829895.tmp: no matching architecture in universal wrapper
        /private/var/folders/9g/s52593k52h7g6r6jc54g_p7m0000gn/T/jna16528589360030829895.tmp: no matching architecture in universal wrapper

Full report at:
/var/folders/9g/s52593k52h7g6r6jc54g_p7m0000gn/T/clojure-15086078284734753662.edn

I'm not sure if that's something odd going on with my machine (mac with the newish M1 chip). Does this happen for you? @PEZ might be able to help further here.

bpringe commented 2 years ago

I do get the same error at jack-in as you, but now I'm unsure if it's due to the same reason.

bpringe commented 2 years ago

Ok I solved that error above by using a workaround mentioned here, but jack-in still fails for me as it does for you.

Are you able to run this project in development mode using the instructions in the readme (without Calva's jack-in)?

real-iceman commented 2 years ago

Yes, I can successfully run npx shadow-cljs server and then connect in Calva.

In the meantime, I have updated VSCode and Calva to 1.60.0 / 2.0.211 but this had no impact on jack-in via deps.edn + shadow-cljs.

bpringe commented 2 years ago

So jack-in by itself in this case does not start a shadow-cljs build. This is the command it issues when choosing deps.edn + shadow-cljs:

clojure -Sdeps '{:deps {nrepl/nrepl {:mvn/version,"0.8.3"},cider/cider-nrepl {:mvn/version,"0.26.0"}}}' -A:dev -m nrepl.cmdline --middleware "[cider.nrepl/cider-middleware]"

So, when you try to connect to the :workspaces build via the menu, it fails because that build isn't running.

I don't use this jack-in type, so I'm not sure what should be done in this case to use jack-in to run and connect to the :workspaces build, or if this is something that's supposed to be possible, but maybe @PEZ can provide more info.

agoldhammer commented 2 years ago

I have also encountered this problem, which I think has to do with the wrong path being used with WSL2. If I start VSCode from a Linux shell with the command code ., Calva can find npx, but if I start VSCode by double-clicking in Windows and then opening a remote WSL:Ubuntu window, npx is not found. This was not the case in the past, if I remember correctly, but I'm not sure which Calva build caused it to fail. If I start shadow-cljs in the shell, I can "Connect to running REPL in project" with no problem.