shadow-cljs

roklenarcic 2026-01-25T09:24:41.150129Z

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?

thheller 2026-01-28T10:56:00.109449Z

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

roklenarcic 2026-01-28T11:57:55.661449Z

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

roklenarcic 2026-01-28T11:59:41.731719Z

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"

roklenarcic 2026-01-28T11:59:55.337779Z

seems to work still

roklenarcic 2026-01-28T12:00:32.022879Z

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

thheller 2026-01-28T12:10:14.593739Z

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.

roklenarcic 2026-01-28T12:11:17.538399Z

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

thheller 2026-01-28T12:12:02.053729Z

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

thheller 2026-01-28T12:12:23.550189Z

the alternative I was referring to is this https://shadow-cljs.github.io/docs/UsersGuide.html#_option_running_via_clj_directly

souenzzo 2026-01-25T18:17:48.269209Z

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

roklenarcic 2026-01-25T18:18:44.750289Z

I see. Thanks