Welcome! Please see the About page for a little more info on how this works.

0 votes
in ClojureScript by

Attempts to build ClojureScript result in an error.

Here is the cljs file:

(ns gauss-gun-web-2.core
    (:require [reagent.core :as r]) ;; Error goes away if you comment this line out
)

(-> (.getElementById js/document "content")
    (.-innerHTML)
(set! "Hello, World! This is my first ClojureScript :) "))

Here is project.clj:

`

(defproject my-project-name "0.1.0-SNAPSHOT"

    :description "FIXME: write description"
    :url "http://example.com/FIXME"

    :dependencies [[ch.qos.logback/logback-classic "1.2.7"]
                   [clojure.java-time "0.3.3"]
                   [conman "0.9.3"]
                   [cprop "0.1.19"]
                   [expound "0.8.10"]
                   [funcool/struct "1.4.0"]
                   [json-html "0.4.7"]
                   [luminus-http-kit "0.1.9"]
                   [luminus-migrations "0.7.1"]
                   [luminus-transit "0.1.3"]
                   [luminus/ring-ttl-session "0.3.3"]
                   [markdown-clj "1.10.7"]
                   [metosin/muuntaja "0.6.8"]
                   [metosin/reitit "0.5.15"]
                   [metosin/ring-http-response "0.9.3"]
                   [mount "0.1.16"]
                   [nrepl "0.9.0"]
                   [org.clojure/clojure "1.10.3"]
                   [org.clojure/tools.cli "1.0.206"]
                   [org.clojure/tools.logging "1.1.0"]
                   [org.postgresql/postgresql "42.2.23"]
                   [org.webjars.npm/bulma "0.9.3"]
                   [org.webjars.npm/material-icons "1.0.0"]
                   [org.webjars/webjars-locator "0.42"]
                   [ring-webjars "0.2.0"]
                   [ring/ring-core "1.9.4"]
                   [ring/ring-defaults "0.3.3"]
                   [selmer "1.12.45"]
                   [org.clojure/clojurescript "1.10.914" :scope "provided"]
                   [re-frame "1.3.0-rc2"]
                   [reagent "1.1.0"]
                   ;[fork "2.4.2"]
                   ]

    :min-lein-version "2.0.0"

    :source-paths ["src/clj"]
    :test-paths ["test/clj"]
    :resource-paths ["resources", "target/cljsbuild"]
    :target-path "target/%s/"
    :cljsbuild {
                :builds {:app {:source-paths ["src/cljs"]
                               :compiler {:output-to "target/cljsbuild/public/js/app.js"
                                          :output-dir "target/cljsbuild/public/js/out"
                                          :main "my-project-name.core"
                                          :asset-path "/js/out"
                                          :optimizations :none
                                          :source-map true
                                          :pretty-print true}}}
                :clean-targets ^{:protect false}
                [:target-path [:cljsbuild :builds :app :compiler :output-dir "resources/public/js/"]
                 [:cljsbuild :builds :app :compiler :output-to "resources/public/js/"]]
                }

    :main ^:skip-aot my-project-name.core

    :plugins [
              [lein-cprop "1.0.1"]
              [migratus-lein "0.2.6"]
              [lein-cljsbuild "1.1.8"]]

    :profiles
    {:uberjar {:omit-source true
               :aot :all
               :uberjar-name "my-project-name.jar"
               :source-paths ["env/prod/clj" ]
               :resource-paths ["env/prod/resources"]}

     :dev           [:project/dev :profiles/dev]
     :test          [:project/dev :project/test :profiles/test]

     :project/dev  {:jvm-opts ["-Dconf=dev-config.edn" ]
                    :dependencies [[org.clojure/tools.namespace "1.1.1"]
                                   [pjstadig/humane-test-output "0.11.0"]
                                   [prone "2021-04-23"]
                                   [ring/ring-devel "1.9.4"]
                                   [ring/ring-mock "0.4.0"]]
                    :plugins      [[com.jakemccrary/lein-test-refresh "0.24.1"]
                                   [jonase/eastwood "0.3.5"]
                                   [cider/cider-nrepl "0.26.0"]]

                    :source-paths ["env/dev/clj" ]
                    :resource-paths ["env/dev/resources"]
                    :repl-options {:init-ns user
                                   :timeout 120000}
                    :injections [(require 'pjstadig.humane-test-output)
                                 (pjstadig.humane-test-output/activate!)]}
     :project/test {:jvm-opts ["-Dconf=test-config.edn" ]
                    :resource-paths ["env/test/resources"] }
     :profiles/dev {}
     :profiles/test {}})

`
When I run:

$ cljsbuild once

I get this error:

Warning: implicit hook found: lein-cprop.plugin/hooks Hooks are deprecated and will be removed in a future version. Compiling ClojureScript... Compiling ["target/cljsbuild/public/js/app.js"] from ["src/cljs"]... Compiling ["target/cljsbuild/public/js/app.js"] failed. clojure.lang.ExceptionInfo: failed compiling file:target/cljsbuild/public/js/out/reagent/impl/component.cljs {:file #object[java.io.File 0x6ee5cd06 "target/cljsbuild/public/js/out/reagent/impl/component.cljs"], :clojure.error/phase :compilation} at cljs.compiler$compile_file$fn4031.invoke(compiler.cljc:1765) at cljs.compiler$compile_file.invokeStatic(compiler.cljc:1725) at cljs.compiler$compile_file.invoke(compiler.cljc:1701) at cljs.closure$compile_file.invokeStatic(closure.clj:660) at cljs.closure$compile_file.invoke(closure.clj:638) at cljs.closure$fn5527.invokeStatic(closure.clj:734) at cljs.closure$fn5527.invoke(closure.clj:728) at cljs.closure$fn5440$G54335447.invoke(closure.clj:556) at cljs.closure$compile_from_jar.invokeStatic(closure.clj:707) at cljs.closure$compile_from_jar.invoke(closure.clj:697) at cljs.closure$fn5531.invokeStatic(closure.clj:744) at cljs.closure$fn5531.invoke(closure.clj:728) at cljs.closure$fn5440$G54335447.invoke(closure.clj:556) at cljs.closure$compile_sources$iter56535657$fn5658.invoke(closure.clj:1105) at clojure.lang.LazySeq.sval(LazySeq.java:42) at clojure.lang.LazySeq.seq(LazySeq.java:51) at clojure.lang.Cons.next(Cons.java:39) at clojure.lang.RT.next(RT.java:713) at clojure.core$next5403.invokeStatic(core.clj:64) at clojure.core$dorun.invokeStatic(core.clj:3130) at clojure.core$doall.invokeStatic(core.clj:3136) at clojure.core$doall.invoke(core.clj:3136) at cljs.closure$compile_sources.invokeStatic(closure.clj:1101) at cljs.closure$compile_sources.invoke(closure.clj:1090) at cljs.closure$build.invokeStatic(closure.clj:3241) at cljs.closure$build.invoke(closure.clj:3145) at cljs.build.api$build.invokeStatic(api.clj:231) at cljs.build.api$build.invoke(api.clj:212) at cljs.build.api$build.invokeStatic(api.clj:218) at cljs.build.api$build.invoke(api.clj:212) at cljsbuild.compiler$compile_cljs$fn18710.invoke(compiler.clj:61) at cljsbuild.compiler$compile_cljs.invokeStatic(compiler.clj:60) at cljsbuild.compiler$compile_cljs.invoke(compiler.clj:48) at cljsbuild.compiler$run_compiler.invokeStatic(compiler.clj:168) at cljsbuild.compiler$run_compiler.invoke(compiler.clj:129) at user$eval18939$iter1898718991$fn18992$fn19018.invoke(form-init14466059707374101833.clj:1) at user$eval18939$iter1898718991$fn18992.invoke(form-init14466059707374101833.clj:1) at clojure.lang.LazySeq.sval(LazySeq.java:42) at clojure.lang.LazySeq.seq(LazySeq.java:51) at clojure.lang.RT.seq(RT.java:535) at clojure.core$seq5419.invokeStatic(core.clj:139) at clojure.core$dorun.invokeStatic(core.clj:3121) at clojure.core$doall.invokeStatic(core.clj:3136) at clojure.core$doall.invoke(core.clj:3136) at user$eval18939.invokeStatic(form-init14466059707374101833.clj:1) at user$eval18939.invoke(form-init14466059707374101833.clj:1) at clojure.lang.Compiler.eval(Compiler.java:7181) at clojure.lang.Compiler.eval(Compiler.java:7171) at clojure.lang.Compiler.load(Compiler.java:7640) at clojure.lang.Compiler.loadFile(Compiler.java:7578) at clojure.main$load_script.invokeStatic(main.clj:475) at clojure.main$init_opt.invokeStatic(main.clj:477) at clojure.main$init_opt.invoke(main.clj:477) at clojure.main$initialize.invokeStatic(main.clj:508) at clojure.main$null_opt.invokeStatic(main.clj:542) at clojure.main$null_opt.invoke(main.clj:539) at clojure.main$main.invokeStatic(main.clj:664) at clojure.main$main.doInvoke(main.clj:616) at clojure.lang.RestFn.applyTo(RestFn.java:137) at clojure.lang.Var.applyTo(Var.java:705) at clojure.main.main(main.java:40) Caused by: clojure.lang.ExceptionInfo: null #:clojure.error{:source nil, :line nil, :column nil, :phase :compilation} at cljs.analyzer$analyze.invokeStatic(analyzer.cljc:4269) at cljs.analyzer$analyze.invoke(analyzer.cljc:4255) at cljs.compiler$emit_source.invokeStatic(compiler.cljc:1581) at cljs.compiler$emit_source.invoke(compiler.cljc:1554) at cljs.compiler$compile_fileSTAR$fn__4000.invoke(compiler.cljc:1668) at cljs.compiler$with_core_cljs.invokeStatic(compiler.cljc:1474) at cljs.compiler$with_core_cljs.invoke(compiler.cljc:1463) at cljs.compiler$compile_fileSTAR.invokeStatic(compiler.cljc:1652) at cljs.compiler$compile_fileSTAR.invoke(compiler.cljc:1645) at cljs.compiler$compile_file$fn4031.invoke(compiler.cljc:1750) ... 60 more Caused by: clojure.lang.ExceptionInfo: No such namespace: react, could not locate react.cljs, react.cljc, or JavaScript source providing "react" in file target/cljsbuild/public/js/out/reagent/impl/component.cljs {:tag :cljs/analysis-error} at cljs.analyzer$error.invokeStatic(analyzer.cljc:719) at cljs.analyzer$error.invoke(analyzer.cljc:715) at cljs.analyzer$error.invokeStatic(analyzer.cljc:717) at cljs.analyzer$error.invoke(analyzer.cljc:715) at cljs.analyzer$analyze_deps.invokeStatic(analyzer.cljc:2645) at cljs.analyzer$analyze_deps.invoke(analyzer.cljc:2612) at cljs.analyzer$ns_side_effects.invokeStatic(analyzer.cljc:4131) at cljs.analyzer$ns_side_effects.invoke(analyzer.cljc:4126) at cljs.analyzer$analyzeSTAR$fn2886.invoke(analyzer.cljc:4253) at clojure.lang.PersistentVector.reduce(PersistentVector.java:343) at clojure.core$reduce.invokeStatic(core.clj:6829) at clojure.core$reduce.invoke(core.clj:6812) at cljs.analyzer$analyzeSTAR.invokeStatic(analyzer.cljc:4253) at cljs.analyzer$analyzeSTAR.invoke(analyzer.cljc:4244) at cljs.analyzer$analyze.invokeStatic(analyzer.cljc:4272) ... 69 more

OS is Ubuntu 20.04

I have installed node, react, etc. It looks to me like cljsbuild cannot find the cljs bindings to react, although I'm not 100% since I'm new to cljs.

Am I doing something wrong?

Please log in or register to answer this question.

...