is there anybody know how to find a clue of this error?
1. npx create-cljs-project test-project 2. yarn add react react-dom 3. add reagent 1.0.0 into shadow-cljs.edn 4. shadow-cljs server error: [:failed-to-compare "16.13.0" "16.13.0" #error { :cause "Cannot invoke \"Object.getClass()\" because \"target\" is null" :via [{:type java.lang.NullPointerException :message "Cannot invoke \"Object.getClass()\" because \"target\" is null" :at [clojure.lang.Reflector invokeInstanceMethod "Reflector.java" 97]}] :trace [[clojure.lang.Reflector invokeInstanceMethod "Reflector.java" 97] [shadow.cljs.devtools.server.npm_deps$make_engine invokeStatic "npm_deps.clj" 39] [shadow.cljs.devtools.server.npm_deps$make_engine invoke "npm_deps.clj" 32] [shadow.cljs.devtools.server.npm_deps$fn__14943$fn__14944 invoke "npm_deps.clj" 46] [clojure.lang.Delay deref "Delay.java" 42] [clojure.core$deref invokeStatic "core.clj" 2320] [clojure.core$deref invoke "core.clj" 2306] [shadow.cljs.devtools.server.npm_deps$fn__14943$fn__14946 invoke "npm_deps.clj" 52] [shadow.cljs.devtools.server.npm_deps$is_installed_QMARK_ invokeStatic "npm_deps.clj" 207] [shadow.cljs.devtools.server.npm_deps$is_installed_QMARK_ invoke "npm_deps.clj" 201] [shadow.cljs.devtools.server.npm_deps$main$fn__15031 invoke "npm_deps.clj" 223] [clojure.core$complement$fn__5669 invoke "core.clj" 1441] [clojure.core$filter$fn__5893 invoke "core.clj" 2821] [clojure.lang.LazySeq sval "LazySeq.java" 42] [clojure.lang.LazySeq seq "LazySeq.java" 51] [clojure.lang.RT seq "RT.java" 535] [clojure.core$seq__5402 invokeStatic "core.clj" 137] [clojure.core$seq__5402 invoke "core.clj" 137] [shadow.cljs.devtools.server.npm_deps$main invokeStatic "npm_deps.clj" 225] [shadow.cljs.devtools.server.npm_deps$main invoke "npm_deps.clj" 216] [shadow.cljs.devtools.cli$main invokeStatic "cli.clj" 143] [shadow.cljs.devtools.cli$main doInvoke "cli.clj" 134] [clojure.lang.RestFn applyTo "RestFn.java" 137] [clojure.core$apply invokeStatic "core.clj" 669] [clojure.core$apply invoke "core.clj" 660] [shadow.cljs.devtools.cli$_main invokeStatic "cli.clj" 221] [shadow.cljs.devtools.cli$_main doInvoke "cli.clj" 219] [clojure.lang.RestFn applyTo "RestFn.java" 137] [clojure.lang.Var applyTo "Var.java" 705] [clojure.core$apply invokeStatic "core.clj" 665] [clojure.main$main_opt invokeStatic "main.clj" 514] [clojure.main$main_opt invoke "main.clj" 510] [clojure.main$main invokeStatic "main.clj" 664] [clojure.main$main doInvoke "main.clj" 616] [clojure.lang.RestFn applyTo "RestFn.java" 137] [clojure.lang.Var applyTo "Var.java" 705] [clojure.main main "main.java" 40]]}] [:failed-to-compare "16.13.0" "16.13.0" #error { :cause "Cannot invoke \"Object.getClass()\" because \"target\" is null" :via [{:type java.lang.NullPointerException :message "Cannot invoke \"Object.getClass()\" because \"target\" is null" :at [clojure.lang.Reflector invokeInstanceMethod "Reflector.java" 97]}] :trace [[clojure.lang.Reflector invokeInstanceMethod "Reflector.java" 97] [shadow.cljs.devtools.server.npm_deps$make_engine invokeStatic "npm_deps.clj" 39] [shadow.cljs.devtools.server.npm_deps$make_engine invoke "npm_deps.clj" 32] [shadow.cljs.devtools.server.npm_deps$fn__14943$fn__14944 invoke "npm_deps.clj" 46] [clojure.lang.Delay deref "Delay.java" 42] [clojure.core$deref invokeStatic "core.clj" 2320] [clojure.core$deref invoke "core.clj" 2306] [shadow.cljs.devtools.server.npm_deps$fn__14943$fn__14946 invoke "npm_deps.clj" 52] [shadow.cljs.devtools.server.npm_deps$is_installed_QMARK_ invokeStatic "npm_deps.clj" 207] [shadow.cljs.devtools.server.npm_deps$is_installed_QMARK_ invoke "npm_deps.clj" 201] [shadow.cljs.devtools.server.npm_deps$main$fn__15031 invoke "npm_deps.clj" 223] [clojure.core$complement$fn__5669 invoke "core.clj" 1441] [clojure.core$filter$fn__5893 invoke "core.clj" 2821] [clojure.lang.LazySeq sval "LazySeq.java" 42] [clojure.lang.LazySeq seq "LazySeq.java" 51] [clojure.lang.RT seq "RT.java" 535] [clojure.core$seq__5402 invokeStatic "core.clj" 137] [clojure.core$seq__5402 invoke "core.clj" 137] [shadow.cljs.devtools.server.npm_deps$main invokeStatic "npm_deps.clj" 225] [shadow.cljs.devtools.server.npm_deps$main invoke "npm_deps.clj" 216] [shadow.cljs.devtools.cli$main invokeStatic "cli.clj" 143] [shadow.cljs.devtools.cli$main doInvoke "cli.clj" 134] [clojure.lang.RestFn applyTo "RestFn.java" 137] [clojure.core$apply invokeStatic "core.clj" 669] [clojure.core$apply invoke "core.clj" 660] [shadow.cljs.devtools.cli$_main invokeStatic "cli.clj" 221] [shadow.cljs.devtools.cli$_main doInvoke "cli.clj" 219] [clojure.lang.RestFn applyTo "RestFn.java" 137] [clojure.lang.Var applyTo "Var.java" 705] [clojure.core$apply invokeStatic "core.clj" 665] [clojure.main$main_opt invokeStatic "main.clj" 514] [clojure.main$main_opt invoke "main.clj" 510] [clojure.main$main invokeStatic "main.clj" 664] [clojure.main$main doInvoke "main.clj" 616] [clojure.lang.RestFn applyTo "RestFn.java" 137] [clojure.lang.Var applyTo "Var.java" 705] [clojure.main main "main.java" 40]]}]
and i used shadow-cljs and i install & remove so many program even kernel .. after that it is not working anymore. im trying to find a reason. but dont have a clue.
@b4 which java -version
do you use? and which shadow-cljs version?
java version is openjdk 15.0.1 2020-10-20 OpenJDK Runtime Environment (build 15.0.1+9-18) OpenJDK 64-Bit Server VM (build 15.0.1+9-18, mixed mode, sharing)
shadow-cljs 2.11.7
do you use project.clj or deps.edn? or just shadow-cljs.edn?
only deps.edn
and you have that shadow-cljs version in deps.edn
?
no.
i found adding cljs-ajax into shadow-cljs.edn's dependencies is working but reagent and re-frame is not.
no means you don't use deps.edn right?
ok. i have test two project. 1st is with deps.edn 2nd is make a project "npx create-cljs-project test-project" that is don't use deps.edn.
both has same error.
I'm asking because jdk15 removed nashorn. so if you are not actually on the version you listed above that would cause the error.
ie. if you are on an older version. which version is listed when you start shadow-cljs?
i can't find anything when i exec shadow-cljs server. could u tell me how can i check?
it is listed when you start it
shadow-cljs server
then it will print shadow-cljs - server version: <version> running at <http://localhost:9630>
on startup
shadow-cljs - HTTP server available at http://localhost:9999 shadow-cljs - server version: 2.9.10 running at http://localhost:9630 shadow-cljs - nREPL server started on port 9100
see that is an old version
do you maybe have an older shadow-cljs global install?
try npx shadow-cljs server
or npm install -g shadow-cljs
it is working.!!! thanks very much.
and thanks for ur shadow-cljs!
Does anybody know if there is a way to evaluate forms from the REPL in the context of a web-worker module?
I have my main application loading my web-worker module (setup with :web-worker true
in shadow-cljs), but the web-worker keeps some state in an atom that I don’t think I can access from the REPL currently?
@victorbjelkholm429 yeah, that’s the other alternative. I have avoided that so far just because the postMessage boundary between the worker and the main thread keeps me honest (ha!), and gives a good indication of the general performance characteristics for the release build. I do something similar though when working on the worker from the REPL - I sometimes just load the namespace into the main thread, work on it in pieces in a REPL-driven way, then once I’m done saving the file updates the code in the worker context.
Just guessing now but my hunch is on "no", as web workers don't have access to any communication protocols/transports except "postMessage" from the web context. You would have to setup your own "proxiying" somehow (repl => web context => postMessage to worker, then back), but not sure how that'd work scratch that, was thinking of service workers, not web workers
Alternatively, write your web-worker in a way that you can either run it embedded in the page or as a proper web worker, so in development you run it in the same scope as the web app itself, and you can use the repl normally. When you wanna release/deploy, make the embedded web worker into a proper one where you use postMessage to communicate
@austinbirch you can REPL in the webworker just fine but no editor currently allows you selecting the runtime to eval in
one way you can is using the UI. just tap>
something in the worker and it will show up in the web UI inspect
that has an eval window
Ah, right - that makes sense.
web workers can open websockets just fine which is the only things the shadow-cljs REPL needs
The actual problem I was having was that I’ve fallen into a more REPL-driven workflow, and that stopped working for the web worker.
Not really a big deal though - I can just lean on the hot reloading and tap>
/ js/console.log
or whatever.
Thanks for the help.
you can do the REPL workflow in web workers just fine
BUT when you open a website with code using a worker you'll have two completely separate runtimes
Not redefining functions etc from Cursive though? Ends up defining the functions in the ‘main thread’ rather than the web worker context?
one is the regular webpage and one is the worker. they don't share anything
Yeah, that’s it.
so when you eval stuff you need to "select" which runtime you actually want to work in
and that is unfortunately not supported by any editor at the moment so it is kind of clunky to do
That’s fine, I’d rather keep the REPL working for the regular webpage and just use reloading + tap>
for the worker context. It’s not that bad of a tradeoff, still a nice workflow.
If editors added support for selecting the runtime then I’d probably use that, but it’s not a huge problem.
What is the best practice to use circleci with shadow-cljs? is there any example of config (shadow-cljs project > config.yml)? Thanks!
to do what exactly? you can just run the normal commands
@sb example config for a project I'm working on: https://github.com/instantwebsite/dashboard/blob/master/.circleci/config.yml (fairly trivial stuff though)
thank you very much ! that is really cool example!!
if you want the compiled output, just add another npx shadow-cljs compile
step + archive_artifacts
I would like to learn from others how they create the .yml file etc (avoid fails, faster learning curve etc). Nothing extra
I also have it setup for shadow-cljs itself
https://github.com/thheller/shadow-cljs/blob/master/.circleci/config.yml
although that first uses lein to do stuff since I can't use shadow-cljs only after I have built it so it should be an unconventional setup
> Just `tap>` something in the worker and it will show up in the web UI inspect > that has an eval window @thheller I’ve just used the Inspect UI for the first time… wow! This is so great! Thanks so much for your work on this, it’s really really helpful. Today has been a good developer tooling day for me; I’ve been trying out https://github.com/jpmonettas/flow-storm-debugger and it’s pretty smart, and now I’ve got Inspect to use as well.
after shadow’s dev server reloads my app, the dom appears to be reset to this:
<html><head></head><body><input type="text" name="history_state1" id="history_state1" style="display:none"></body></html>
why isn’t it at a very minimum using the static html page i have for the react container?this is not shadow-cljs doing that
something in your code (or libraries) is responsible for that
looks like you might be initializing goog.History multiple times. that does that IIRC.
thank you so much! that was it