I'm getting this error: [Figwheel:WARNING] Compile Exception…
- User
I'm getting this error:
[Figwheel:WARNING] Compile Exception D:\Projects\Coding\clojure-training-2024-simple-server-playground\src\simple_server\core.cljs line:10 column:14
No such namespace: hiccup.core, could not locate hiccup/core.cljs, hiccup/core.cljc, or JavaScript source providing "hiccup.core" in file D:\Projects\Coding\clojure-training-2024-simple-server-playground\src\simple_server\core.cljs
5 [goog.events :as events] 6 [goog.history.EventType :as HistoryEventType] 7 [reagent.core :as r :refer [atom]] 8 [reagent.dom :as rdom] 9 [reitit.core :as reitit] 10 [hiccup.core :refer [html]] ^--- 11 [hiccup.page :refer [html5 include-css]]) 12 (:import goog.History)) 13
14
15 (def guess-val (r/atom 5))[Figwheel:SEVERE] failed compiling file:D:\Projects\Coding\clojure-training-2024-simple-server-playground\src\simple_server\core.cljs
My project.clj is this:
(defproject simple-server "0.1.0-SNAPSHOT" :description "FIXME: write description" :url "http://example.com/FIXME" :license {:name "EPL-2.0 OR GPL-2.0-or-later WITH Classpath-exception-2.0" :url "https://www.eclipse.org/legal/epl-2.0/"}
:min-lein-version "2.7.1"
:dependencies [[org.clojure/clojure "1.10.0"] [org.clojure/clojurescript "1.11.4"] [cljsjs/react "17.0.2-0"] [cljsjs/react-dom "17.0.2-0"] [reagent "1.1.1"] [org.clojure/core.async "1.6.681"]
[cljs-ajax "0.8.4"] [cljs-http "0.1.46"] [compojure "1.6.1"] [ring/ring-defaults "0.3.2"] [hiccup "1.0.5"] [metosin/reitit "0.5.18"]]:source-paths ["src"]
:aliases {"fig:build" ["run" "-m" "figwheel.main" "-b" "dev" "-r"] "fig:min" ["run" "-m" "figwheel.main" "-O" "advanced" "-bo" "dev"] "fig:test" ["run" "-m" "figwheel.main" "-co" "test.cljs.edn" "-m" "simple-server.test-runner"]}
:profiles {:dev {:dependencies [[com.bhauman/figwheel-main "0.2.17"] [org.slf4j/slf4j-nop "1.7.30"]]
:resource-paths ["target"] ;; need to add the compiled assets to the :clean-targets :clean-targets ^{:protect false} ["target"]}})Is this an error in the project.clj or in the cljs file I'm working on?
- Assistant
It appears that your error is occurring because you are trying to require a namespace (
hiccup.core) within a ClojureScript file (core.cljs). However, the library you've included in your project—hiccup—is meant to be used with Clojure on the server side and does not have a ClojureScript counterpart that provides ahiccup.corenamespace. In ClojureScript, you would typically not use Hiccup directly, but might instead use something like Reagent, which you have already included.You should remove the references to
hiccup.coreand from your file since they are not applicable for ClojureScript. Instead, you can use Reagent for rendering React components, which allows for writing Hiccup-like syntax in ClojureScript.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.