Fork me on GitHub
#calva
<
2021-04-30
>
Stuart13:04:21

Trying to open the get started repl on windows and seeing this error.

java -jar ".calva\deps.clj.jar" -Sdeps "{:deps {nrepl/nrepl {:mvn/version,""0.8.3""},cider/cider-nrepl {:mvn/version,""0.25.11""}}}"  -m nrepl.cmdline --middleware "[cider.nrepl/cider-middleware]"
Error while parsing option "--config-data {:deps {nrepl/nrepl {:mvn/version,0.8.3},cider/cider-nrepl {:mvn/version,0.25.11}}}": java.lang.NumberFormatException: Invalid number: 0.8.3
Jack-in process exited. Status: 1
I click nREPL in the bottom bar. Click Fire up the "Getting started" REPL Click use Existing Temp Directory The REPL Output window shows:
; Jacking in...
; Starting Jack-in Terminal: java -jar ".calva\deps.clj.jar" -Sdeps "{:deps {nrepl/nrepl {:mvn/version,""0.8.3""},cider/cider-nrepl {:mvn/version,""0.25.11""}}}"  -m nrepl.cmdline --middleware "[cider.nrepl/cider-middleware]"
THen the terminal shows the error:
java -jar ".calva\deps.clj.jar" -Sdeps "{:deps {nrepl/nrepl {:mvn/version,""0.8.3""},cider/cider-nrepl {:mvn/version,""0.25.11""}}}"  -m nrepl.cmdline --middleware "[cider.nrepl/cider-middleware]"
Error while parsing option "--config-data {:deps {nrepl/nrepl {:mvn/version,0.8.3},cider/cider-nrepl {:mvn/version,0.25.11}}}": java.lang.NumberFormatException: Invalid number: 0.8.3
Jack-in process exited. Status: 1

Stuart13:04:54

Calva is v2.0.194

alexmiller13:04:30

that "Error while parsing option "--config-data {:deps {nrepl/nrepl {:mvn/version,0.8.3}, ..." looks like the "" is not escaping and just getting removed so it's trying to parse 0.8.3 as a number in the data

Stuart13:04:09

Something I have wrong possibly in a config file or something?

alexmiller13:04:27

well it's something to do with quoting/escaping of the command line for sure

Stuart13:04:27

I didn't think the getting started repl used things in my project, i thought it was standalone

Stuart13:04:45

Tried in a different proejct, and same error. Yet that same project I can connect to a normal repl fine. hmmm

stianalmaas13:04:15

I have the exact same problem. I was inspired to try calva after a presentation Pez had a couple of days ago. It looks like it is an issue with powershell. It is only affecting a few people.

stianalmaas13:04:16

Haven't had time to look into it yet.

alexmiller13:04:22

it would probably be useful to know which version of the clojure cli is installed

alexmiller13:04:14

clojure --version will work on newer versions (`clojure -Sdescribe` on older if that doesn't work)

Stuart13:04:40

Clojure CLI version 1.10.2.796

Stuart13:04:53

If I go to nREPL in toolbar, then click "Start your project with a REPL Server and connect (aka jack-in)" Then choose Leinegen (since this project is a project.clj project) It works fine and I get a repl The terminal for this says

cmd.exe /d /c lein update-in :dependencies conj [nrepl,"0.8.3"] -- update-in :plugins conj [cider/cider-nrepl,"0.25.11"] -- update-in [:repl-options,:nrepl-middleware] conj '["cider.nrepl/cider-middleware"]' -- repl :headless
nREPL server started on port 19008 on host 127.0.0.1 - 

Stuart13:04:08

Seems just to be the getting started repl

pez14:04:27

We will probably never see the end of quoting issues with powershell. 😞 @borkdude and I was at it for weeks straight and it seemed we had it nailed. BTW, the getting started REPL is special. It uses a bundled jar of deps.clj and not the “official” CLI tools.

pez14:04:20

@qmstuart can you report an issue on Calva from within VS Code? Then it will attach some system info.

Stuart14:04:12

How, do I do this? Do you mean this window?

stianalmaas14:04:24

@pez I have the same issue. How do I report this in VS Code?

borkdude14:04:41

@pez This doesn't seem an issue with deps.clj itself but with how your tool is calling the jar? > java -jar ".calva\deps.clj.jar" -Sdeps "{:deps {nrepl/nrepl {:mvn/version,""0.8.3""},cider/cider-nrepl {:mvn/version,""0.25.11""}}}" -m nrepl.cmdline --middleware "[cider.nrepl/cider-middleware]"

borkdude14:04:29

where is the code that calls this jar?

borkdude14:04:48

When shelling out to something on Windows there's usually some escaping that needs to be done for quotes. Are you shelling out from JS/node?

pez14:04:35

@borkdude I didn’t mean to imply that it was a problem in deps.clj. Yes, shelling out from node. Yes, I know there is quoting going on. Tell me about it. 😀 I might have spent a couple of msn months on it in total.

borkdude14:04:38

This is usually needed when args are JSON or EDN (because of embedded strings)

pez14:04:00

I might try it. Don't want to break it everywhere it works though.

borkdude14:04:47

Only apply this on Windows

pez14:04:09

Haha, yes, of course. But it works on every windows machine I can bring up.

pez14:04:32

I even bought a machine, remember? 😀

flowthing15:04:51

I bumped into that quoting issue setting up Calva for a colleague. I don't have a Windows machine handy so I can't test, but one workaround is to modify the "Jack In Dependency Versions" Calva setting such that every value in the PowerShell invocation is triple-quoted.

flowthing15:04:32

At least, that's what worked on my colleague's machine. :man-shrugging::skin-tone-2:

flowthing15:04:10

That is, e.g. {:mvn/version """0.8.3"""} etc.

pez15:04:01

Awesome. Thanks for sharing!

Stuart15:04:27

You mean this?

Stuart15:04:19

I get same error 😞

java -jar ".calva\deps.clj.jar" -Sdeps "{:deps {nrepl/nrepl {:mvn/version,"""0.8.3"""},cider/cider-nrepl {:mvn/version,"""0.25.11"""}}}"  -m nrepl.cmdline --middleware "[cider.nrepl/cider-middleware]"
Error while parsing option "--config-data {:deps {nrepl/nrepl {:mvn/version,0.8.3},cider/cider-nrepl {:mvn/version,0.25.11}}}": java.lang.NumberFormatException: Invalid number: 0.8.3
Jack-in process exited. Status: 1

Stuart15:04:36

bloody windows huh 😄

pez15:04:40

You must json quote the quotes there.

Stuart15:04:06

Yeah, still same problem. Tried single quotes, double quotes, triple quotes

Stuart15:04:42

If you get a potential fix for it, let me know I can help you test it