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

pez15:04:25

I'll take you up on that offer, @qmstuart. It's invaluable to have a machine where we can reproduce.

pez15:04:42

Meanwhile, two things. 1. Maybe try with borkdude's backslash quoting as well? And all things on that command line are not equal so pay close attention to what param the error messages complain about. Then you'll need to add all quoting together. 😀 2. If it is mainly the getting started REPL you want to try out, and you have the CLI tools set up. You can fork and clone the dram repository and jack in to it with the regular command.

flowthing15:04:24

I could check the exact format next week, but I realize that’s a bit late... anyway, the objective is to try to convey the triple quotes into the command-line invocation.

flowthing16:04:08

Oh, I see now that that did happen. No idea why that doesn’t work, then. :man-shrugging::skin-tone-2:

borkdude16:04:36

This all depends whether you are invoking this yourself from a shell, or if Calva is invoking this from node. In the latter case this doesn't have to do anything with your shell.

borkdude16:04:04

So please give a good repro with a lot of details, else I don't think it's actionable.

pez16:04:59

Please give this some calva emojies, dear friends. (In the #news-and-articles channel).

pez16:04:05

@borkdude I think all these attempts have been using the Calva Getting Started REPL command. The super strange and extra tricky thing here is that it behaves so differently on different WIndows machines.

pez16:04:34

For now, I take the win that @flowthing highlights here. That there is at least some workarounds possible by the fact that the injected dependencies are configurable via settings.

flowthing16:04:13

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]"
That doesn't work because of the nested double quotes, right?

flowthing16:04:35

So maybe -Sdeps '{:deps ,,,}' might work (single quotes).

flowthing16:04:45

Or no, not in PowerShell maybe... don't remember.

alexmiller16:04:02

yeah, I don't think single quotes are what you want in powershell

flowthing16:04:31

I'll check the exact invocation Calva makes on my colleague's laptop next week.

borkdude20:04:09

Single quotes do work in PowerShell. Use them as follows: -Sdeps '{:deps {medley/medley {:mvn/version \"1.3.0\"}}}' cc @flowthing

borkdude20:04:22

Note that the double quotes have to be escaped.