shadow-cljs 2026-01-25

How does everyone specify shadow-cljs as a dependency? I used to have it both in package.json devDependency and also in the cljs alias in deps, but LLM informed me that only one of these is needed. Which one do you use?

the thing in package.json is the command line tools, so the actual shadow-cljs command. if you are not using that and use only the clojure tools clj/clojure to drive everything then you do not need the npm install

yeah I tried using just clj tools shadow cljs, then using npx shadow-cljs to run it without having it in package.json

But when I run npx shadow-cljs watch target, I get this:

------------------------------------------------------------------------------

   WARNING: shadow-cljs not installed in project.
   See 

------------------------------------------------------------------------------
shadow-cljs - config: /Users/roklenarcic/clojure-projects/..../shadow-cljs.edn
shadow-cljs - socket connect failed, server process dead?
shadow-cljs - starting via "clojure"

seems to work still

shadow-cljs - HTTP server available at 
shadow-cljs - server version: 3.3.4 running at 
shadow-cljs - nREPL server started on port 9000
shadow-cljs - watching build :target
[:target] Configuring build.
Done in 1ms
[:target] Compiling ...
Done in 4ms
[:target] Build completed. (394 files, 0 compiled, 0 warnings, 1,79s)
Done in 10ms

well yeah but this is exactly what I said. you are using the shadow-cljs command (via npx shadow-cljs), which is the npm package. it is then strongly recommend to have that install in the projects package.json. otherwise you are relying on some random global install which may get out of sync with whatever version you actually want and break.

hm ok I was under impression that I needed it in package.json to run the command without npx prefix

yes and no. npx will use the project local install if present, which is just more reproducible and thus recommended

both are somehow required. For simple projects, you may be able to build without any package.json in your project But in a real project, you will end up with both the deps.edn one is required to use shadow from REPL the package.json one is required to download the runtime deps in node_module

I see. Thanks