shadow-cljs

https://github.com/thheller/shadow-cljs | https://github.com/sponsors/thheller | https://www.patreon.com/thheller
Franklin 2021-06-11T09:32:56.494100Z

hey @thheller I'm having some trouble with using the repl

apiyo@apiyo-ThinkPad:~/git-repos/<my-repo>$ yarn start-repl
yarn run v1.22.10
$ shadow-cljs cljs-repl app
shadow-cljs - config: /home/apiyo/git-repos/<my-repo>/shadow-cljs.edn
log4j:WARN No appenders could be found for logger (org.jboss.logging).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See <http://logging.apache.org/log4j/1.2/faq.html#noconfig> for more info.
shadow-cljs - server version: 2.10.22 running at <http://localhost:9630>
shadow-cljs - nREPL server started on port 3333
WARNING: replace already refers to: #'clojure.core/replace in namespace: ona.utils.helpers, being replaced by: #'clojure.string/replace
WARNING: any? already refers to: #'clojure.core/any? in namespace: chimera.core, being replaced by: #'chimera.core/any?
cljs.user=&gt; (js/console.log "test")
No available JS runtime.
See <https://shadow-cljs.github.io/docs/UsersGuide.html#repl-troubleshootingcljs.user=>&gt; 

Franklin 2021-06-11T09:33:59.494200Z

my app build looks as follows:

{:app {:asset-path "/js/quagga"
        :modules {:shared
                  {:entries []}
                  :organization
                  {:entries [quagga.components.organization.init]
                   :depends-on #{:shared}}
                  :home
                  {:entries [quagga.components.home.init]
                   :depends-on #{:shared}}
                  ...}
        :output-dir "resources/public/js/quagga/"
        :target :browser
        :devtools {:devtools-url "<http://localhost:3000/shadow-cljs>"}}

Franklin 2021-06-11T09:34:36.494400Z

since I'm using a custom HTTP server, I added the :devtools option

Franklin 2021-06-11T09:34:55.494600Z

I'm not sure if I followed the user guide instructions correctly

Franklin 2021-06-11T09:37:39.494800Z

I've also tried {:devtools-url "<http://localhost:9630>"}

Franklin 2021-06-11T09:40:20.495Z

Do I have to build a handler on my server for /shadow-cljs path that proxies requests to http://localhost:9630?

thheller 2021-06-11T10:22:16.495200Z

is your server running on the same machine as shadow-cljs?

thheller 2021-06-11T10:22:44.495500Z

then you likely don't need to set :devtools-url at all

thheller 2021-06-11T10:23:30.495700Z

otherwise you need <http://localhost:9630> assuming shadow-cljs is reachable on that location. you can test by just opening it in the browser, you should get the UI

Franklin 2021-06-11T10:44:20.495900Z

yes, on the same machine

thheller 2021-06-11T10:45:20.496100Z

then you just need to open the generated JS in the browser, no :devtools-url

thheller 2021-06-11T10:45:30.496300Z

check the browser console if it connects properly

Franklin 2021-06-11T11:47:03.496800Z

in the available runtimes tab

Franklin 2021-06-11T11:47:10.497Z

should I find a cljs runtime

thheller 2021-06-11T11:52:37.497300Z

once it is connected yes. check your browser console where you are loading your app.

Franklin 2021-06-11T11:59:17.497500Z

still getting the same error

apiyo@apiyo-ThinkPad:~/git-repos/zebra/quagga$ yarn shadow-cljs cljs-repl app
yarn run v1.22.10
$ /home/apiyo/git-repos/zebra/quagga/node_modules/.bin/shadow-cljs cljs-repl app
shadow-cljs - config: /home/apiyo/git-repos/zebra/quagga/shadow-cljs.edn
log4j:WARN No appenders could be found for logger (org.jboss.logging).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See <http://logging.apache.org/log4j/1.2/faq.html#noconfig> for more info.
shadow-cljs - server version: 2.10.22 running at <http://localhost:9630>
shadow-cljs - nREPL server started on port 3333
WARNING: replace already refers to: #'clojure.core/replace in namespace: ona.utils.helpers, being replaced by: #'clojure.string/replace
WARNING: any? already refers to: #'clojure.core/any? in namespace: chimera.core, being replaced by: #'chimera.core/any?
cljs.user=&gt; 



(js/console.log "test")
No available JS runtime.
See <https://shadow-cljs.github.io/docs/UsersGuide.html#repl-troubleshootingcljs.user=>&gt; 

thheller 2021-06-11T12:00:02.497700Z

and what about the browser console?

thheller 2021-06-11T12:01:21.497900Z

I don't know what you are doing but what you just pasted is just telling me that no runtime has connected back to shadow-cljs. so you either didn't open the compiled code in the browser OR it failed to connect

thheller 2021-06-11T12:01:47.498100Z

I tried explaining how everything works in https://shadow-cljs.github.io/docs/UsersGuide.html#repl-troubleshooting

thheller 2021-06-11T12:01:53.498300Z

I cannot do better here

thheller 2021-06-11T12:02:55.498500Z

if you just care about quickly getting a REPL that is NOT related to your "app" you can just use shadow-cljs browser-repl instead. that'll open a browser on its own.

Franklin 2021-06-11T12:03:51.498700Z

the browser console seems silent... nothing is logged

thheller 2021-06-11T12:04:18.499Z

there MUST be something logged. either "shadow ready" message OR some kind of error or timeout

thheller 2021-06-11T12:04:30.499200Z

I'm assuming here of course you are running a shadow-cljs watch app already

Franklin 2021-06-11T12:07:59.499400Z

no, I wasn't running that...

Franklin 2021-06-11T12:11:03.499600Z

ok... that's what I was missing

Franklin 2021-06-11T12:11:27.499800Z

thanks