This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-08-16
Channels
- # atom-editor (6)
- # babashka (31)
- # beginners (34)
- # calva (1)
- # cider (21)
- # clj-kondo (5)
- # cljsrn (2)
- # clojars (6)
- # clojure (35)
- # clojure-europe (3)
- # clojure-norway (2)
- # clojurescript (4)
- # conjure (10)
- # cursive (8)
- # data-science (78)
- # fulcro (23)
- # graphql (10)
- # helix (2)
- # luminus (1)
- # off-topic (50)
- # other-languages (1)
- # pathom (8)
- # re-frame (9)
- # reagent (9)
- # reitit (1)
- # rewrite-clj (6)
- # shadow-cljs (134)
- # tools-deps (53)
- # vscode (1)
- # xtdb (4)
@pavel.klavik yeah you should check what the message looks like it is sending. its transit but that is somewhat readable. in the chrome devtools network tab select the websocket connection going to
.
that has a "Messages" tab. the message with the error is likely with a green background (sent to server) and starts with ["^ ", "~:op", "~:obj-result", ...
I send there two strings, one "test" which works fine, the other "čau" which fails and I get the following:
The difference I see for the second case is that it also sends this at the end:
@U05224H0W ^^ see the data
hmm ok there is definitely something broken coming. if you look at the :cljs-eval
message the code is definitely garbled
weird how it turns into the proper thing a bit later. so I suppose there is some encoding going on somewhere
can the check the cljs-compile-result message what the :js
code looks like? it is cut off in the screenshot
also check sending the same thing from the terminal. wonder if it shows up garbled as well.
This is what I get when running "čau" in shadow-cljs cljs-repl:
@U05224H0W ^^ (not sure whether you saw my reply)
I do. just no clue whats going on on your machine. I just get the regular "čau"
as expected. no garbled text or weird encodings.
I have no idea what is happening but it seems to start with receiving bad input from the REPL
Also it was not happening till recently. Not sure how long because I haven't tested it for some time. Maybe somehow related to updating Windows or updating of Cursive, not sure. But I haven't update Windows on my laptop and it was broken and it didn't fix with both updating Windows and IntelliJ with Cursive.
Maybe @U0567Q30W will have some idea how to debug Cursive?
doesn't seem to be related to Cursive since the cljs-repl input is also bad. bad in a different way but still incorrect.
that might be related to something I noticed in general that Unicode characters are displayed broken in REPL, even on my server REPL
but not sure whether it also influences input there
@U05224H0W I am running it using shadow-cljs watch client
. This works when I send "čau" from Cursive.
No, node-repl work for both. It just runs Clojure? Or how can I switch to Clojurescript?
I also tested another very simple project I made using Shadow-cljs and it is failing the same, so it is not something we changed in our project recently.
When I run node-repl, what does it connect to? As I understand it, (shadow/repl :client)
switches to ClojureScript REPL for the particular client.
(shadow/repl :client)
switches to the REPL of the :client
build. whatever JS runtime is connected to that
I cannot help you if you only give me half the information about what you are doing.
Sorry, I will try to explain better. I tested running shadow-cljs node-repl
on my project. I connect to the REPL from Cursive and it works as above.
ok, so how does it work?
above you send (shadow/repl :client)
. it will attempt to switch to the REPL of the client build
ya, still makes sense
you do that by running (shadow/node-repl)
or (shadow/repl :node-repl)
in case you already have done shadow-cljs node-repl
ya, I get that, just was not sure what node-repl means or how I should switch to it
it fails the same:
sure, working on it
still the same problem
it is a puzzle, no idea what is going on
you can maybe try going back version by version until it works but I suspect it starts failing when I switched the transport to use transit instead of EDN
in the worst case, I can avoid using non-ASCII characters in my development data so I can run them in REPL without any problems
which version is it?
that is one thing I did, I was using npm install -g shadow-cljs
to run the binary directly, and I had a quite old binary for some time
and recently, I updated it on both devices with npm update -g shadow-cljs
I do hope that you have shadow-cljs installed in the project directly. the global install really doesn't matter all that much then and doesn't have anything to do with this anyways.
I have shadow-cljs as dependency in both project.clj
and package.json
, but I noticed that there was outdated version of Shadow-cljs displayed on the start when running shadow-cljs watch client
, so I tried to update it in this way
well yes the versions should be somewhat close to each other. if you want to avoid guessing remove the global install completely
although you have to run npx shadow-cljs
instead of shadow-cljs
then so kinda annoying 😛
I am getting this output:
C:\Shared\orgpad>shadow-cljs watch client
------------------------------------------------------------------------------
shadow-cljs - config: C:\Shared\orgpad\shadow-cljs.edn
shadow-cljs - socket connect failed, server process dead?
NPM dependency "react" has installed version "^16.13.1"
"16.13.0" was required by jar:file:/C:/Users/pavel/.m2/repository/reagent/reagent/0.10.0/reagent-0.10.0.jar!/deps.cljs
NPM dependency "react-dom" has installed version "^16.13.1"
"16.13.0" was required by jar:file:/C:/Users/pavel/.m2/repository/reagent/reagent/0.10.0/reagent-0.10.0.jar!/deps.cljs
shadow-cljs - HTTP server available at
shadow-cljs - HTTP server available at
shadow-cljs - server version: 2.10.14 running at
shadow-cljs - nREPL server started on port 9000
shadow-cljs - watching build :client
[:client] Configuring build.
[:client] Compiling ...
[:client] Build completed. (934 files, 79 compiled, 0 warnings, 29.43s)
while having this in project.clj
[thheller/shadow-cljs "2.10.18"]
something is very weird ... this extra garbage ---------------
line shouldn't be there anymore. I fixed that.
no, I didn't use that, I have ClojureScript dependencies written twice, once in project.clj for Cursive, and once for Shadow-cljs
{:source-paths ["src"]
:dependencies [[reagent "0.10.0"]
[reagent-utils "0.3.3"]
[re-frame "0.12.0"]
[com.cognitect/transit-cljs "0.8.264"]
[day8.re-frame/http-fx "v0.2.0"]
[hickory "0.7.1"]
[binaryage/devtools "0.9.10"]
[bidi "2.1.6"]
[com.taoensso/sente "1.15.0"]
[venantius/accountant "0.2.5"]
[com.cemerick/url "0.1.2-SNAPSHOT"]
[com.taoensso/timbre "4.10.0"]
[cljc.java-time "0.1.8"]
[bouncer "1.0.1"]
[orgpad/volcano "0.1.2"]
[macchiato/core "0.2.17"]
[macchiato/env "0.0.6"]
[mount "0.1.16"]]
:nrepl {:port 9000}
:builds {:client {:target :browser
:output-dir "resources/public/js/compiled"
:asset-path "/js/compiled"
:modules {:shared {:entries []}
:main {:init-fn orgpad.client.core/init
:depends-on #{:shared}}
:layout {:entries [orgpad.client.layout.webworker.core]
:depends-on #{:shared}
:web-worker true}}
:compiler-options {:infer-externs :auto
:output-feature-set :es6}
:devtools {:after-load orgpad.client.core/mount-root
:before-load orgpad.client.core/stop-web-workers
:watch-dir "resources/public"
:browser-inject :main
:loader-mode :script}}
:landing {:target :browser
:output-dir "landing/resources/js"
:asset-path "/js"
:modules {:main {:init-fn orgpad.landing.dev/init}}
:devtools {:http-root "landing/resources"
:http-port 3500
:after-load orgpad.landing.dev/mount-root
:watch-dir "landing/resources"
:browser-inject :main}}
:emails {:target :browser
:output-dir "emails/js"
:asset-path "/js"
:modules {:main {:init-fn orgpad.server.email.dev/init}}
:devtools {:http-root "emails"
:http-port 3600
:after-load orgpad.server.email.dev/mount-root
:watch-dir "emails"
:browser-inject :main}}
:screenshot {:target :node-script
:main orgpad.screenshot.core/main
:output-to "screenshot/screenshot.js"
:devtools {:autoload true}
:compiler-options {:optimizations :simple}}}}
ah ok. then it doesn't matter what you put in project.clj
at all as far as shadow-cljs is concerned
I see, so I could remove it? And how is the version in package.json
used?
Suppose that I want to update to 10.21. I go and change it in package.json
.
How does it propagates? Do I need to update global shadow-cljs as well?
you can declare the version you want in shadow-cljs.edn
as mentioned above if that helps
ok, that is what I was always doing
it makes sense to keep the global install somewhat on the same level but if you want to be totally sure use npx shadow-cljs
instead
So I updated both to 10.21:
C:\Shared\orgpad>shadow-cljs watch client
shadow-cljs - config: C:\Shared\orgpad\shadow-cljs.edn
shadow-cljs - socket connect failed, server process dead?
NPM dependency "react" has installed version "^16.13.1"
"16.13.0" was required by jar:file:/C:/Users/pavel/.m2/repository/reagent/reagent/0.10.0/reagent-0.10.0.jar!/deps.cljs
NPM dependency "react-dom" has installed version "^16.13.1"
"16.13.0" was required by jar:file:/C:/Users/pavel/.m2/repository/reagent/reagent/0.10.0/reagent-0.10.0.jar!/deps.cljs
shadow-cljs - HTTP server available at
shadow-cljs - HTTP server available at
shadow-cljs - server version: 2.10.21 running at
shadow-cljs - nREPL server started on port 9000
shadow-cljs - watching build :client
[:client] Configuring build.
[:client] Compiling ...
[:client] Build completed. (934 files, 0 compiled, 0 warnings, 99.62s)
I get the same problem while testing both shadow-cljs watch client
and npx shadow-cljs watch client
.Would it be possible to add an option to use EDN instead of Transit?
do you mess with java options in any way? like overriding the default encodings or something?
Probably somehow related to Windows-1250 encoding, maybe the problem got surfaced by switching from edn to transit
no, nothing like that
what do you mean? what are java options?
I don't think there is anything in my JVM_OPTS or anything like that set up, I just installed JVM and didn't set anything up
Connecting to remote nREPL server...
Clojure 1.10.1
(System/getProperty "file.encoding")
=> "Cp1250"
oh hehe. I do actually have JVM_OPTS=-Dfile.encoding=UTF8
as a global environment variable
maybe that does something. try adding :jvm-opts ["-Dfile.encoding=UTF8"]
to your shadow-cljs.edn
?
and probably wipe the .shadow-cljs/builds
dir. no clue how the cache reacts to changing the file encoding 😛
ok, it works 🙂
hmm now I have to figure out where this JVM_OPTS is coming from. I can't remember ever setting this.
Ya, good guessing 🙂.
Thx a lot for figuring this out. @U0567Q30W the solution is to set file.encoding to UTF8 in JVM_OPTS, see the above
Yeah, that’s a bit of a bad name - that’s actually the system encoding. Pavel and I tried setting that for IntelliJ (which IMO is probably a good idea) but it seems like it should be set for shadow too.
maybe I could add a debug flag on the server side that dumps the messages it receives into a file or so
so you could change (map transit-read)
to
(map (fn [x] (try (transit-read x) (catch Exception e (log/warn-ex e ::ws-read-fail {:x x})))))
@U05224H0W How can I change this? From REPL?