Fork me on GitHub
#shadow-cljs
<
2023-03-05
>
pez20:03:51

I'm trying to build Calva in a Circle-CI Windows executor. It exits silently with exit code 0. I get this far:

> [email protected] release-cljs
> npx shadow-cljs release :calva-lib :test

shadow-cljs - config: C:\calva\shadow-cljs.edn
shadow-cljs - starting via "clojure"
No idea how to debug this. Using SSH to run the job and can reproduce that I get the prompt back with exit code 0. This is the output from shadow-cljs --cli-info:
circleci@packer-633b1a5a-0497-e7a7-b9ea-8d92e4a35fcb  /c/calva
$ npx shadow-cljs --cli-info
shadow-cljs - config: C:\calva\shadow-cljs.edn
=== Version
jar:            2.19.2
cli:            2.19.2
deps:           1.3.2
config-version: 2.19.2

=== Paths
cli:     C:\calva\node_modules\shadow-cljs\cli\dist.js
config:  C:\calva\shadow-cljs.edn
project: C:\calva
cache:   .shadow-cljs

=== Java
openjdk version "11.0.12" 2021-07-20
OpenJDK Runtime Environment Microsoft-25199 (build 11.0.12+7)
OpenJDK 64-Bit Server VM Microsoft-25199 (build 11.0.12+7, mixed mode)

=== Source Paths
Anyone else have any ideas?

thheller05:03:23

since it stops at starting with "clojure" have you tried running with directly with clojure?

thheller05:03:58

so clojure -M -m shadow.cljs.devtools.cli release :calva-lib :test?

thheller05:03:41

(the windows clj tools only work in powershell, so if its a normal shell prepend powershell -command clojure ...)

thheller07:03:35

are the clojure tools even installed? I'm honestly not sure which error code the shadow-cljs command will have it is doesn't exist

pez07:03:18

It works with clojure -M -m shadow.cljs.devtools.cli. At least via SSH and using bash.exe. Same bash prompt where npx shadow-cljs exits early. I think it might have to do with clojure not being installed where npx/npm are looking for it. Because it doesn't work when run as part of the npm script that runs things. Trying now with installing clojure in a different directory...

pez07:03:44

The feedback turnaround time is painful. For some reason Windows executors are super slow. It takes 10 minutes to learn if something works or not...

thheller07:03:09

you can just run with the clojure command directly

thheller07:03:35

makes no difference to the builds in any way

pez07:03:49

On my mac shadow exits with code 1 if I don't have clojure installed.

~/Projects/calva(windows-e2e-test|✔) % npm run watch-cljs

> [email protected] watch-cljs
> npx shadow-cljs -d cider/cider-nrepl:0.28.5 watch :calva-lib :test

shadow-cljs - config: /Users/pez/Projects/calva/shadow-cljs.edn
shadow-cljs - starting via "clojure"
Executable 'clojure' not found on system path.
~/Projects/calva(windows-e2e-test|✔) % echo $? 
1

thheller08:03:18

mac != win in those regards 😛

thheller08:03:45

what do you mean bash.exe btw? do you run things in WSL?

pez08:03:10

Right now I am failing to get clojure on the system path on Circle CI. But when I get that working, I'll report back if the workaround to use clojure directly to run things works.

thheller08:03:37

clojure is a powershell command in windows, so unless you are working in powershell I don't really follow what you are doing

pez08:03:55

CircleCi allows for using bash.exe as the shell. It has git and mingw and things installed, so I guess that's why bash is an option.

thheller08:03:35

but what does bash have to do with anything? do you have the clojure linux tools installed in that?

pez08:03:08

I am actually using the exe-packaged deps.clj renamed to clojure.

thheller08:03:31

that will not work

thheller08:03:48

the shadow-cljs command expects the official tools.deps cli tools

thheller08:03:52

and runs them through powershell

thheller08:03:08

if you don't have those installed, you'll need to manually run whatever else you have

pez08:03:21

It works fine from the bash prompt in the CI executor using npx shadow-cljs release ....

thheller08:03:22

but as a I said it makes absolutely no difference to the builds

thheller08:03:09

I'd still not recommend doing that. seems like you are trying very hard to confuse the shadow-cljs command 😛

thheller08:03:48

maybe whatever bash.exe is doing makes (is-windows?) return false?

pez08:03:45

Correction, it doesn't work with npx shadow-cljs, what I mean is that it works fine when using clojure -M -m shadow.cljs.devtools.cli release .... Which is what I am trying to do now. But failing because I don't understand Circle CI windows stuff.

thheller08:03:51

then just use clojure directly and the problem is solved. if you use deps.edn literally everything the npx shadow-cljs release command does is run clojure -M -m shadow.cljs.devtools.cli release for you

pez08:03:55

I have never succeeded in installing the official clojure tools on windows. A lot of users have problems with this. Which is why deps.clj will soon be the recommended tool to use there.

pez08:03:39

The problem will hopefully be solved once I get clojure on the path. 😃

thheller08:03:02

shadow-cljs works fine with the official windows tools.deps cli tools

pez08:03:19

Yes it does.

pez08:03:00

I think it works fine with deps.clj exe renamed to clojure too.

pez08:03:20

At least it does on my windows machines.

thheller08:03:42

well, as I just linked in it will run through powershell is (is-windows?) is true

thheller08:03:57

if that alternate clojure command works in powershell thats fine I guess

thheller08:03:09

but there is no detection for alternate clojure installs

pez08:03:53

I don't think there needs to be any further detections as long as powershell finds the executable.

Aron Gabor23:03:01

Hi. I am having a weird issue, I have something in shadow-cljs.edn, but shadow-cljs installs something else, I think 😟

Aron Gabor23:03:38

{:dependecies [[datascript "1.4.1"]
               [reagent "1.2.0"]]
 :source-paths ["src"]
 :builds
 {:app {:target :browser
        :output-feature-set :es-next
        :output-dir "public/assets/app/js"
        :asset-path "/assets/app/js"
        :modules {:main {:init-fn mock-compare/start}}
        :compiler-options {:externs ["datascript/externs.js"]}}}

 :dev-http
 {8080 {:root "public"}}}

Aron Gabor23:03:51

The required namespace "reagent.core" is not available, it was required by "mock_compare.cljs".

Aron Gabor23:03:40

❯ shadow-cljs info | rg -i reagent
shadow-cljs - config: /Users/gabora/repos/vf/local/tools/analysis/shadow-cljs.edn
openjdk version "17.0.5" 2022-10-18
OpenJDK Runtime Environment Temurin-17.0.5+8 (build 17.0.5+8)
OpenJDK 64-Bit Server VM Temurin-17.0.5+8 (build 17.0.5+8, mixed mode)

Aron Gabor23:03:04

Maybe my require is wrong, but I thought it would show up in info output anyway?

Aron Gabor23:03:27

I even removed .shadow-cljs/ directory

chrisetheridge05:03:28

:dependecies is spelled incorrectly 🙂 its should be :dependencies

Aron Gabor06:03:36

thanks @U0HJ7CX6H, this is why I shouldn't do late night coding

chrisetheridge06:03:51

haha no problem 😄