2016-10-14 5 views
0

私は非常に簡単なプロジェクトを持っています。私はbootとcljsでもっともシンプルなプロジェクトを作りました。それは正常にコンパイルされ、私はhtmlで正しいログを見ることができました。私は非同期のための基本的なサポートを追加したとき、私はメッセージが表示されました:シンプルなブートプロジェクトがcljsとasyncで動作しない

No such namespace: clojure.core.async, could not locate clojure/core/async.cljs, clojure/core/async.cljc, or Closure namespace "clojure.core.async" 

プロジェクトだけで、以下の構造を有する:index.htmlをの

exemplo_cljs 
    html 
     index.html 
    src 
     exemplo_cljs 
      core.cljs 
    build.boot 

内容:

<!doctype html> 
<html lang="en"> 
    <head> 
     <title>Hello</title> 
    </head> 
    <body> 
     <h2>Hello</h2> 
     <script src="main.js"></script> 
    </body> 
</html> 

コア.cljs

(ns exemplo-cljs.core 
    (:require [clojure.core.async :as async])) 

(def exercise (async/chan)) 

;; enable cljs to print to the JS console of the browser 
(enable-console-print!) 

;; print to the console 
(println "Hello, World 4!") 

そしてbuild.boot

(set-env! 
:source-paths #{"src"} 
:resource-paths #{"html"} 

:dependencies '[[adzerk/boot-cljs "1.7.170-3"] 
       [org.clojure/core.async "0.2.371"]]) 

(require '[adzerk.boot-cljs :refer [cljs]]) 

元の現用プロジェクトが以外は同じ基本構造を持っていた必要とcore.cljsファイルのチャンネルのDEFとためだbuild.boot

答えて

2

で追加の依存関係ClojureScriptでは、core.asyncはclojure.core.asyncではなくcljs.core.asyncになります。

だから、あなただけにあなたのNSフォームを変更する必要があります。それはレインで働いていたいくつかの奇妙な理由で

(ns exemplo-cljs.core 
    (:require [cljs.core.async :as async])) 
+0

。私は起動時に移行すると混乱します。 –

+1

cljsのバージョンが異なっていましたか?私はcljs/Clojureのインポート名前空間が最近変更されたと思った。参照:http://blog.fikesfarm.com/posts/2016-07-03-clojurescript-clojure-namespace-aliasing.html –

関連する問題