Search code examples
macosinstallationgoogle-chrome-devtoolsclojurescript

How to install Dirac (a Chrome DevTools fork for ClojureScript) on macOS Monterey 12.5 if error: "Could not locate clojure/data/ files" appears?


I am trying to install Dirac on a Macbook Air M1 running Monterey 12.5.

I am following the documentation which indicates:

curl -s https://raw.githubusercontent.com/binaryage/dirac/master/install > /tmp/dirac.install && sudo bash /tmp/dirac.install

The installation seems to have worked out since it exists on binaries:

   Pedros-MacBook-Air:bin pedro$ pwd
   /usr/local/bin

   Pedros-MacBook-Air:bin pedro$ ls -1
   dirac
   lein

Unfortunately, when I go to the 2nd step on manual which is running dirac, the error below is retrieved:

   Pedros-MacBook-Air:bin pedro$ dirac
   WARNING: update-vals already refers to: #'clojure.core/update-vals in namespace: clojure.tools.analyzer.utils, being replaced by: #'clojure.tools.analyzer.utils/update-vals
   WARNING: update-keys already refers to: #'clojure.core/update-keys in namespace: clojure.tools.analyzer.utils, being replaced by: #'clojure.tools.analyzer.utils/update-keys
   WARNING: update-vals already refers to: #'clojure.core/update-vals in namespace: clojure.tools.analyzer, being replaced by: #'clojure.tools.analyzer.utils/update-vals
   WARNING: update-keys already refers to: #'clojure.core/update-keys in namespace: clojure.tools.analyzer, being replaced by: #'clojure.tools.analyzer.utils/update-keys
   WARNING: update-vals already refers to: #'clojure.core/update-vals in namespace: clojure.tools.analyzer.passes, being replaced by: #'clojure.tools.analyzer.utils/update-vals
   WARNING: update-vals already refers to: #'clojure.core/update-vals in namespace: clojure.tools.analyzer.passes.uniquify, being replaced by: #'clojure.tools.analyzer.utils/update-vals
   Execution error (FileNotFoundException) at dirac.nrepl.compilation.direct/eval15283$loading (direct.clj:1).
   Could not locate clojure/data/json__init.class, clojure/data/json.clj or clojure/data/json.cljc on classpath.

Full report at:
/var/folders/fh/7d_1drwd2ps3zw03j9ftkqs80000gn/T/clojure-1010884132545121253.edn

Initially, I tried running it at home folder. I thought it would work out fine.

Then, I decided to run it inside a project folder that had the file clojure/data/json.clj included in the the project.clj file. Unfortunately, even this approach did not work out.

Below you see a simplified version of the project.clj file:

(defproject abcd    ; Should be copied from shadow-cljs.edn
  :description "xxxx"
  :url "xxxx"

  :dependencies [[org.clojure/clojure "1.9.0"]
                 [org.clojure/clojurescript "1.10.339"]
                 [org.clojure/tools.nrepl "RELEASE"]
                 [binaryage/devtools ~devtools-version]
                 [binaryage/dirac ~dirac-version]
                 [org.clojure/data.json "2.4.0"]
                 [figwheel ~figwheel-version]
                 ;; Selmer for templating of .json config files
                 [selmer "1.12.50"]]

... (omitted content because it seems irrelevant) ...

  :profiles {:repl
             {:repl-options {:port             8230
                             :nrepl-middleware [dirac.nrepl/middleware]
                             :init             (do
                                                 (require 'dirac.agent)
                                                 (dirac.agent/boot!))


}}})

1 - I thought Dirac would work out even outside of the project folder. Is it necessary to be in the project folder?

2 - Why is Dirac complaining about the Json library even though it is listed as a dependency? Is there any difference between clojure/data/json.clj (error message retrieved) and org.clojure/data.json (my dependency)?


Solution

  • You've received a workaround on dirac/issues/98: adding {:deps {org.clojure/data.json {:mvn/version "2.4.0"}}} to ~/.clojure/deps.edn.

    The local launcher script has a dependency on the release version of ClojureScript, that no longer includes clojure/data.json. A better workaround is changing the /usr/local/bin/dirac file line 119 by adding clojure.data.json there as well (or pinning to a ClojureScript version before 1.11.51):

    DEPS="{:deps {\
      $DIRAC_CLI_DEPS_COORDINATE \
      org.clojure/clojurescript {:mvn/version \"RELEASE\"} \
      org.clojure/data.json {:mvn/version \"2.4.0\"} \ 
      clj-logging-config/clj-logging-config {:mvn/version \"1.9.12\"} \
    }}"
    

    Explanation

    The dependency org.clojure/data.json was removed from ClojureScript in version 1.11.51 of May 13th 2022. See release notes:

    Vendorization of tools.reader, data.json, and transit-clj
    (...)
    After conferring with the Clojure Team, we decided to vendorize all these dependencies. This way we can AOT everything and be confident that we won’t create a conflict that can’t easily be fixed via normal dependency management. (...) The dependance on data.json has been removed.