Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/clojure/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
clojurescript找不到cljs.core.async.macros_Clojure_Clojurescript_Core.async - Fatal编程技术网

clojurescript找不到cljs.core.async.macros

clojurescript找不到cljs.core.async.macros,clojure,clojurescript,core.async,Clojure,Clojurescript,Core.async,我在client.cljs文件中有以下代码: (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.

我在client.cljs文件中有以下代码:

(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
项目文件如下所示:

(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})
…编译时会出现以下错误:

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
请注意,我的代码是从这里复制过来的:这家伙的项目具有相同的依赖项,并且可以正常工作

知道为什么吗?谢谢

更新:
我的cljsbuild是自动生成的。重新启动cljsbuild后,它的编译就可以了。谢谢

您的
project.clj
文件似乎缺少项目使用的存储库

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

只有当您的错误与brepl有关时


如果您试图在“标准”clojurescript brepl中使用此代码,首先需要在repl中计算clojure宏代码,然后从brepl中获得异步宏。此外,您还可以尝试在brepl上进行交互式编码@cemerick/austin工具

我也遇到过这种情况。运行
lein-cljsbuild-clean
使cljsbuild能够拉入库并成功生成。

当我(错误地)使用
时出现此错误:在我的
cljs.core.async
要求中包含宏true

;; THROWS ERROR
(ns my-ns
  (:require [cljs.core.async :refer [<!] :include-macros true])
  (:require-macros [cljs.core.async.macros :refer [go]]))
;;抛出错误
(ns我的ns
(:require[cljs.core.async:参考[
移除它有效:

;; DOES NOT THROW ERROR
(ns my-ns
  (:require [cljs.core.async :refer [<!]])
  (:require-macros [cljs.core.async.macros :refer [go]]))
;;不会引发错误
(ns我的ns

(:require[cljs.core.async:refere[cljsbuild处于自动状态。重新启动cljsbuild后,它编译得很好

您是否在修改项目后重新启动了
lein-cljsbuild
。clj?我没有。我的cljsbuild处于自动状态!重新启动cljsbuild后,它工作了…或者使用正确的Maven版本[org.clojure/core.async“0.1.242.0-44b1e3-alpha”]-但如果您希望core.Async的最新版本通常是正确的,除非他将代码基于另一个使用快照版本的项目。在这种情况下,最好先让代码正常工作,然后再切换到“适当的Maven版本”.显然是真的-这就是为什么我自己没有回答,我只是想注意一下。一般来说,使用快照版本不是很好的做法,因为它们会自动更新,从而扰乱版本控制。例如,早期提交可能无法使用,因为它只与早期快照一起工作。它的工作原理相同即使我添加了:repositories。似乎cljsbuild必须重新启动。感谢这样的方法修复了它。正如您在更新部分所看到的,这个版本就是问题所在。我运行了一个长寿命的“lein cljsbuild auto”在后台。重新启动cljsbuild后,一切正常。仅供参考,这是因为宏已移动到
cljs.core.async.macros