Web Development with Clojure, Third Edition: Issue adding Shadow CLJS

Title: Web Development with Clojure, Third Edition, pg 116

Hi - I just started chapter 5 and I am stuck on page 116 while trying to start up shadow CLJS. Here is the error

shadow-cljs - nREPL server started on port 7002
shadow-cljs - watching build :app
[:app] Configuring build.
[:app] Compiling ...
[:app] Build failure:
The required namespace "guestbook.core" is not available, it was required by "guestbook/app.cljs".
"guestbook/core.clj" was found on the classpath. Should this be a .cljs file?

Here is my project.clj dev profile

:project/dev  {:jvm-opts ["-Dconf=dev-config.edn" ]
                  :dependencies [[pjstadig/humane-test-output "0.10.0"]
                                 [prone "2020-01-17"]
                                 [ring/ring-devel "1.8.1"]
                                 [ring/ring-mock "0.4.0"]
                                 [thheller/shadow-cljs "2.11.4"]
                                 [binaryage/devtools "0.9.10"]]
                  :plugins      [[com.jakemccrary/lein-test-refresh "0.24.1"]
                                 [jonase/eastwood "0.3.5"]] 
                  :source-paths ["env/dev/clj" "env/dev/cljc" "env/dev/cljs"]
                  :resource-paths ["env/dev/resources"]
                  :repl-options {:init-ns user
                                 :timeout 120000}
                  :injections [(require 'pjstadig.humane-test-output)
                               (pjstadig.humane-test-output/activate!)]}

Here is my setup:

Any ideas here? Loving the book by the way, an enjoyable first dive into Clojure web development.

1 Like

I’ve figured this one out. The previous project.clj with the :cljsbuild config had its own :source-paths [“src/cljs”] entry. When switching over to shadow-cljs, we also have to add “src/cljs” to our lein :source-paths. This isn’t called out in the current version of the book and might be worth including.
Thanks

2 Likes

Oops, sorry about that! We’ll fix that in the next release.

Thanks for bringing this to our attention, and thanks for reading!

1 Like

I’m also having an issue with adding shadow-cljs, but my error is different from the one jesse050717 was having. I’m get the error “Syntax error compiling var at (shadow/build/compiler.clj:488:13).
Unable to resolve var: comp/source-map-data-gen-col in this context” When I run “npx shadow-cljs watch app”. Any idea? Should I create separate topic for my issue rather than folding into this one? Thanks for the great book!

NVM. I went to the source provided with the book and got it working. I was hoping to get through the book without “cheating”, but…

Still great book!