Clojurescript could not find cljs.core.async.macros

I have the following code in client.cljs file:

(ns onn.client (:require [enfocus.core :as ef] [enfocus.effects :as effects] [enfocus.events :as events] [clojure.browser.repl :as repl] [goog.net.XhrIo :as xhr] [cljs.core.async :as async :refer [chan close!]]) (:use-macros [enfocus.macros :only [deftemplate defsnippet defaction]]) (:require-macros [cljs.core.async.macros :refer [go alt!]] )) ;....the actual code follows 

The project file is as follows:

 (defproject onn "DEV-SNAPSHOT" :description "FIXME: write this!" :url "http://exampl.com/FIXME" :dependencies [[org.clojure/clojure "1.5.1"] [ring/ring-core "1.1.8"] [ring/ring-jetty-adapter "1.1.8"] [org.clojure/clojurescript "0.0-1820"] [org.clojure/core.async "0.1.0-SNAPSHOT"] [enfocus "2.0.0-SNAPSHOT"]] :plugins [[lein-cljsbuild "0.3.2"] [lein-ring "0.8.3"]] :cljsbuild {:builds [{:source-paths ["src"], :compiler {:pretty-print true, :output-to "resources/public/js/main.js", :warnings true, :optimizations :whitespace}}]} :ring {:handler onn.server/app :port 3000}) 

... when compiled gives me this error:

 Caused by: clojure.lang.ExceptionInfo: Could not locate cljs/core/async/macros__init.class or cljs/core/async/macros.clj on classpath: at line 1 src/onn/client.cljs 

Please note that my code is copied here: https://github.com/Dimagog/AsyncGET/blob/master/cljs/app.cljs This guy project has the same dependencies and it works.

Any idea why? Thanks!

UPDATE: My cljsbuild was on a car. After restarting cljsbuild, it compiles just fine. Thanks!

+6
source share
5 answers

cljsbuild was turned on automatically. After reloading cljsbuild it compiled just fine

0
source

I got this error when I was (mistakenly) using :include-macros true in my requirement for cljs.core.async :

 ;; THROWS ERROR (ns my-ns (:require [cljs.core.async :refer [<!] :include-macros true]) (:require-macros [cljs.core.async.macros :refer [go]])) 

Removal worked:

 ;; DOES NOT THROW ERROR (ns my-ns (:require [cljs.core.async :refer [<!]]) (:require-macros [cljs.core.async.macros :refer [go]])) 
+6
source

Your project.clj file project.clj not have a repository that uses the AsyncGET project.

 :repositories { "sonatype-oss-public" "https://oss.sonatype.org/content/groups/public/" } 
+3
source

I also came across this. Running lein cljsbuild clean enabled cljsbuild to pull out the library and succeed.

+1
source

Only if your error is related to brepl ...

If you are trying to use this code in the β€œstandard” clojurescript brepl, you first need to evaluate the clojure macro code in repl, and then asynchronous macros will be available from brepl. Alternatively, you can try using interactive coding on the @ cemerick / austin tool https://github.com/cemerick/austin

0
source

Source: https://habr.com/ru/post/957345/


All Articles