The required namespace "react-dom" is not available, it was required by "reagent/dom.cljs"

I try to compile my shadoww-cljs project but suddenly I see this error message

npx shadow-cljs watch app
npx: installed 97 in 6.104s
shadow-cljs - config: /home/roelof/reagent-projects/shadow-cljs.edn
shadow-cljs - HTTP server available at http://localhost:8280
shadow-cljs - server version: 2.16.12 running at http://localhost:9630
shadow-cljs - nREPL server started on port 41677
shadow-cljs - watching build :app
[:app] Configuring build.
[:app] Compiling ...
[:app] Build failure:
The required namespace "react-dom" is not available, it was required by "reagent/dom.cljs".

I use it only on this :

(ns toy-project1.core
  (:require
   [reagent.dom :as rdom]
   [re-frame.core :as re-frame]
   [toy-project1.events :as events]
   [toy-project1.views :as views]
   [toy-project1.config :as config]))


(defn dev-setup []
  (when config/debug?
    (println "dev mode")))

(defn ^:dev/after-load mount-root []
  (re-frame/clear-subscription-cache!)
  (let [root-el (.getElementById js/document "app")]
    (rdom/unmount-component-at-node root-el)
    (rdom/render [views/main-panel] root-el)))

(defn init []
  (re-frame/dispatch-sync [::events/initialize-db])
  (dev-setup)
  (mount-root))

https://shadow-cljs.github.io/docs/UsersGuide.html#_missing_js_dependency

1 Like

thanks

I hope I can find out what this one is.

The required namespace "ajax.core" is not available, it was required by "toy_project1/events.cljs".

I did npm install ajax and npm install ajax.core but the error stays

Just so this topic doesn’t seem abandoned - as mentioned on Slack, ajax.core likely comes from a CLJS library cljs-ajax. You don’t install it via NPM, you use it as a regular CLJS dependency - via deps.edn or project.clj or shadow-cljs.edn.