簡體   English   中英

為什么在 lein repl 中運行函數時會得到 FileNotFoundExpection?

[英]Why do I get a FileNotFoundExpection when running a function in lein repl?

使用這個 Clojure project.clj我在 Windows cmd 中使用了一個 REPL

lein figwheel

我運行了以下宏

(ns bota-web.views
    (:require [re-frame.core :as re-frame]
              [re-com.core :as re-com]))

結果為零。 我期待這個結果。

然后我在 Windows cmd 中使用了一個 REPL

lein repl

我運行了相同的宏,看看下面發生了什么。

D:\Dropbox\DATA\MyClojureProjects\bota-web>lein repl
nREPL server started on port 59329 on host 127.0.0.1 - nrepl://127.0.0.1:59329
REPL-y 0.3.7, nREPL 0.2.12
Clojure 1.8.0
Java HotSpot(TM) Client VM 1.8.0_45-b15
Docs: (doc function-name-here)
      (find-doc "part-of-name-here")
Source: (source function-name-here)
Javadoc: (javadoc java-object-or-class-here)
Exit: Control+D or (exit) or (quit)
Results: Stored in vars *1, *2, *3, an exception in *e

user=> (ns bota-web.views
  #_=>     (:require [re-frame.core :as re-frame]
  #_=>               [re-com.core :as re-com]))

FileNotFoundException Could not locate re_frame/core__init.class or re_frame/core.clj on classpath. Please check that namespaces with dashes use underscores in the Clojure file name.  clojure.lang.RT.load (RT.java:456)
user=>

鑒於project.clj可以確定為什么我這次收到 FileNotFoundException 嗎?

當您運行lein figwheel您將啟動一個ClojureScript REPL,因此您可以require CLJS 命名空間(例如re-frame.core )。

當您使用lein repl您將啟動一個僅適用於 Clojure 命名空間的Clojure REPL,因此出現錯誤:Clojure 嘗試查找名為re-frame.core Clojure 命名空間,但它失敗了。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM