没有这样的名称空间:clojurescript项目设置中的clojure.spec.alpha [英] No such namespace: clojure.spec.alpha in clojurescript project setup

查看:102
本文介绍了没有这样的名称空间:clojurescript项目设置中的clojure.spec.alpha的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试学习 clojure.spec 。在使用启动构建工具设置clojure项目时,我遇到以下错误,同时需要clojure.spec.alpha。

I am trying to learn clojure.spec. While setting up a clojure project along boot build tool I am getting following error while requiring the clojure.spec.alpha.

Compiling ClojureScript...
• js/app.js
No such namespace: clojure.spec.alpha, could not locate clojure/spec/alpha.cljs, clojure/spec/alpha.cljc, or Closure namespace "clojure.spec.alpha" in f
ile src/cljs/flowparser/app.cljs
Elapsed time: 0.141 sec

我的启动配置如下:

(def +version+ "0.0.1-SNAPSHOT")
(def +description+ "Parses graph DSL for VADE")

(set-env!
  :source-paths #{"src/cljs"}
  :resource-paths #{"resources"}
  :dependencies '[
                  [org.clojure/clojure "1.9.0-alpha16"]
                  [org.clojure/clojurescript "1.9.521"]
                  [org.clojure/core.async "0.3.442"]
                  [adzerk/boot-cljs "2.0.0" :scope "test"]
                  [adzerk/boot-cljs-repl "0.3.3" :scope "test"]
                  [adzerk/boot-reload "0.5.1" :scope "test"]
                  [pandeiro/boot-http "0.8.0" :scope "test"]
                  [com.cemerick/piggieback "0.2.1" :scope "test"]
                  [org.clojure/tools.nrepl "0.2.13" :scope "test"]
                  [weasel "0.7.0" :scope "test"]
                  [crisptrutski/boot-cljs-test "0.3.0" :scope "test"]
                  [binaryage/dirac "1.2.7" :scope "test"]
                  [powerlaces/boot-cljs-devtools "0.2.0" :scope "test"]
                  [proto-repl "0.3.1" :scope "test"]
                  [proto-repl-charts "0.3.2" :scope "test"]
                  [boot-codox "0.10.3" :scope "test"]
                  [adzerk/bootlaces "0.1.13"]])

(require
 '[adzerk.boot-cljs      :refer [cljs]]
 '[adzerk.boot-cljs-repl :refer [cljs-repl start-repl]]
 '[adzerk.boot-reload    :refer [reload]]
 '[pandeiro.boot-http    :refer [serve]]
 '[crisptrutski.boot-cljs-test :refer [test-cljs]]
 '[powerlaces.boot-cljs-devtools :refer [cljs-devtools dirac]]
 '[codox.boot :refer [codox]]
 '[adzerk.bootlaces :refer :all])

(bootlaces! +version+ :dont-modify-paths? true)

(task-options!
  pom {:project     'vadelabs/flowparser
       :version     +version+
       :description +description+
       :url         "https://github.com/pntripathi9417/flowparser"
       :scm         {:url "https://github.com/pntripathi9417/flowparser"}
       :license     {"Eclipse Public License"
                     "http://www.eclipse.org/legal/epl-v10.html"}})

(deftask build []
  (comp (speak)
        (cljs)))

(deftask run []
  (comp (serve)
        (watch)
        (cljs-repl)
        (dirac)
        (reload)
        (build)
        (target)))

(deftask production []
  (task-options! cljs {:optimizations :advanced})
  identity)

(deftask development []
  (task-options! cljs {:optimizations :none}
                 reload {:on-jsload 'flowparser.app/init})
  identity)

(deftask dev
  "Simple alias to run application in development mode"
  []
  (comp (development)
        (run)))

(deftask docs []
  "Generates documentation for the library"
  (comp (codox
          :name "vadelabs/flowparser"
          :description +description+
          :version +version+
          :language :clojurescript
          :output-path ".")
        (target :dir #{"docs"})))

我的主要app.cljs文件如下:

My Main app.cljs file is as follows:

(ns flowparser.app
  (:require [clojure.spec.alpha :as spec]))

(defn init []
  "Hello World")

由于我刚开始使用 clojure ,有关此类问题的任何建议将大有帮助。

As I am just starting out with clojure any suggestions regarding these kind of issues would be greatly helpful.

谢谢

推荐答案

您在特别棘手的时刻选择了规范。 Clojure 1.9.0-alpha16刚刚将名称空间从 clojure.spec 更改为 clojure.spec.alpha

You're picking up spec at a particularly tricky moment. Clojure 1.9.0-alpha16 just changed namespaces from clojure.spec to clojure.spec.alpha.

ClojureScript对master进行了等效更改,但尚未发布新版本。因此,对于ClojureScript< = 1.9.521,您需要改为使用 clojure.spec 作为所需的命名空间。

ClojureScript has made the equivalent changes on master but a new version has not yet been released. So for ClojureScript <= 1.9.521, you'll need to instead use clojure.spec as the namespace you require.

这篇关于没有这样的名称空间:clojurescript项目设置中的clojure.spec.alpha的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆