I want to start a project with reagent and figwheel and I have done it before with that command and it has worked, in fact they still work. But with a new one some of the configurations and versions of dependencies changed and it no longer starts with 'lein fighwheel'. Here is my project.clj
(defproject ajedrez1 "0.1.0-SNAPSHOT"
:description "FIXME: write this!"
:url "http://example.com/FIXME"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:min-lein-version "2.9.1"
:dependencies [[org.clojure/clojure "1.10.0"]
[org.clojure/clojurescript "1.10.773"]
[org.clojure/core.async "0.4.500"]
[reagent "0.10.0" :exclusions [cljsjs/react cljsjs/react-dom cljsjs/react-dom-server]]]
:plugins [[lein-figwheel "0.5.20"]
[lein-cljsbuild "1.1.7" :exclusions [[org.clojure/clojure]]]]
:source-paths ["src"]
:cljsbuild {:builds
[{:id "dev"
:source-paths ["src"]
:figwheel {:on-jsload "ajedrez1.core/on-js-reload"
:open-urls ["http://localhost:3449/index.html"]}
:compiler {:main ajedrez1.core
:target :bundle
:asset-path "js/compiled/out"
:output-to "resources/public/js/compiled/out/index.js"
:output-dir "resources/public/js/compiled/out"
:bundle-cmd {:none ["npx.cmd" "webpack" "--mode=development"]
:default ["npx.cmd" "webpack"]}
:source-map-timestamp true
:preloads [devtools.preload]}}
{:id "min"
:source-paths ["src"]
:compiler {:output-to "resources/public/js/compiled/ajedrez1.js"
:main ajedrez1.core
:optimizations :advanced
:pretty-print false}}]}
:figwheel {:css-dirs ["resources/public/css"] ;; watch and update CSS}
:profiles {:dev {:dependencies [[binaryage/devtools "1.0.0"]
[figwheel-sidecar "0.5.20"]]
:source-paths ["src" "dev"]
:clean-targets ^{:protect false} ["resources/public/js/compiled"
:target-path]}})
It throws:
Figwheel: Cutting some fruit, just a sec ...
Figwheel: Validating the configuration found in project.clj
Figwheel: Configuration Valid ;)
Figwheel: Starting server at http://0.0.0.0:3449
Figwheel: Watching build - dev
Figwheel: Cleaning build - dev
Compiling build :dev to "resources/public/js/compiled/out/index.js" from ["src"]...
Failed to compile build :dev from ["src"] in 16.531 seconds.
---- Exception ----
clojure.lang.ExceptionInfo : :build-cmd :none failed
java.io.IOException : Cannot run program "npx.cmd": CreateProcess error=2, El sistema no puede encontrar el archivo especificado
java.io.IOException : CreateProcess error=2, El sistema no puede encontrar el archivo especificado
I tried pulling out:
:exclusions [cljsjs/react cljsjs/react-dom cljsjs/react-dom-server]]
:target :bundle
:bundle-cmd {:none ["npx.cmd" "webpack" "--mode=development"]
:default ["npx.cmd" "webpack"]}
because the previous projects didn't have it and succesfully compiled but the browser only shows "Figwheel template Checkout your developer console." with "Failed to load resource: the server responded with a status of 404 (Not Found)" on the console.
I tried with 'lein clen' after adding:
:clean-targets ^{:protect false} [:target-path
[:cljsbuild :builds :app :compiler
:output-dir]
[:cljsbuild :builds :app :compiler
:output-to]]
but it's the same.
Just in case, I've been experiencing a stack overflow with the repl when I evaluate the same expresion more than one time, the evaluation's time grows with each repetition. I have to restart it periodically.
Related
I have a project.clj file that has sever cljsbuilds and Figwheel seems to only be compiling the first one. Any ideas why?
The project.clj looks like this:
(defproject tech.projectx/clients "0.1.0-SNAPSHOT"
:cljsbuild {:builds {:renderer {:source-paths ["src/renderer" "src/common"]
:compiler {:output-to "app/renderer/renderer.js"
:output-dir "app/renderer"
:asset-path "renderer"
:main configurator.core
:language-in :ecmascript5
:optimizations :none}}
:main {:source-paths ["src/main" "src/common"]
:compiler {:output-to "app/main/main.js"
:output-dir "app/main"
:asset-path "main"
:main tech.projectx.main
:target :nodejs
:externs ["node_modules/closurecompiler-externs/path.js"
"node_modules/closurecompiler-externs/process.js"]
:optimizations :simple}} ; without this, the packed application doesn't work.
:renderer-test {:source-paths ["src/renderer" "src/common" "test/renderer"]
:compiler {:output-to "test-app/renderer/renderer.js"
:output-dir "test-app/renderer"
:asset-path "renderer"
:main clientcommon.test-runner
:language-in :ecmascript5
:optimizations :none
:source-map true
:source-map-timestamp true
:pretty-print true}
:figwheel {:websocket-host "localhost"
:on-jsload "clientcommon.test-runner/run-all-tests"}}
:test-app-main {:source-paths ["test/main" "src/main" "src/common"]
:compiler {:output-to "test-app/main/main.js"
:output-dir "test-app/main"
:asset-path "main"
:main tech.projectx.test-app-main
:target :nodejs
:externs ["node_modules/closurecompiler-externs/path.js"
"node_modules/closurecompiler-externs/process.js"]
:optimizations :none
:source-map true
:source-map-timestamp true
:pretty-print true}}}}
:sass {:source-paths ["src/renderer/assets"]
:target-path "app/renderer/assets"
:source-map true}
:figwheel {:server-logfile "log/figwheel-logfile.log"
:css-dirs ["app/renderer/assets"]}
:profiles {:dev {:cljsbuild {:builds {:renderer {:compiler {:source-map true
:source-map-timestamp true
:pretty-print true}
:figwheel {:websocket-host "localhost"
:on-jsload "configurator.core/mount-root"}}
:main {:compiler {:source-map "app/main/main.js.map"
:source-map-timestamp true
:pretty-print true}}}}}
:prod {:cljsbuild {:builds {:renderer {:compiler {:optimizations :simple
:closure-defines {goog.DEBUG false}}}
:main {:compiler {:optimizations :simple
:closure-defines {goog.DEBUG false}}}}}}})
I'm running Figwheel with a script that looks like this:
(use 'figwheel-sidecar.repl-api)
(start-figwheel!) ;; <-- fetches configuration
(cljs-repl)
Although you asked, how to pass it to the script, I usually tend to manifest that in the config (in the top level :figwheel entry):
:figwheel { :builds-to-start ["dev" "test"] }
Also see the docs:
A vector of build ids that you would like figwheel to start building
when you invoke lein figwheel without arguments.
I'm using the following the following query to return a subset of a string in a column:
SELECT
REGEXP_EXTRACT(content, r'/\ :dependencies\ \[(.*?)\]]\ /g') AS deps
FROM x[my-test-162023:lab.clj_files_results_030904]
but returns the following:
Row deps
1 null
2 null
3 null
4 null
5 null
6 null
I've tested the regex pattern on http://www.regexpal.com/ and https://regex101.com/r/Gjre2i/2 and it seems to be working.
Any help/hints are appreciated.
UPDATE:
The table I'm trying to query is looks like the following:
Row content
1 (defproject spaghetti "0.1.0-SNAPSHOT" :description "FIXME: write description" :url "http://example.com/FIXME" :license {:name "Eclipse Public License" :url "http://www.eclipse.org/legal/epl-v10.html"} :source-paths ["src/clj" "src/cljs"] :dependencies [[org.clojure/clojure "1.6.0"] [org.clojure/clojurescript "0.0-2371" :scope "provided"] [org.clojure/core.async "0.1.346.0-17112a-alpha"] [ring "1.3.1"] [compojure "1.2.0"] [enlive "1.1.5"] [om "0.7.3"] [figwheel "0.1.4-SNAPSHOT"] [environ "1.0.0"] [com.cemerick/piggieback "0.1.3"] [weasel "0.4.3-SNAPSHOT"] [leiningen "2.5.0"] [http-kit "2.1.19"] [com.cognitect/transit-cljs "0.8.188"] ; [devcards "0.1.2-SNAPSHOT"] [sablono "0.2.22"] [prismatic/om-tools "0.3.3"]] :plugins [[lein-cljsbuild "1.0.3"] [lein-environ "1.0.0"]] :min-lein-version "2.5.0" :uberjar-name "spaghetti.jar" :cljsbuild {:builds {:app {:source-paths ["src/cljs/spaghetti"] :compiler {:output-to "resources/public/js/app.js" :output-dir "resources/public/js/out" :source-map "resources/public/js/out.js.map" :optimizations :none :preamble ["react/react.min.js" "public/js/adsr/index.js" "public/js/WebMIDIAPIWrapper/js/WebMIDIAPIWrapper.js" "public/js/hammerjs/hammer.min.js" "public/js/wavy-jones/wavy-jones.js"] :externs ["react/externs/react.js" "public/js/adsr/adsr.externs.js" "public/js/WebMIDIAPIWrapper/WebMIDIAPIWrapper.externs.js" "public/js/hammerjs/hammerjs.externs.js" "public/js/wavy-jonewavy-jones.externs.js"] :pretty-print true}}}} :profiles {:dev {:repl-options {:init-ns spaghetti.server :timeout 120000 :nrepl-middleware [cemerick.piggieback/wrap-cljs-repl]} :plugins [[lein-figwheel "0.1.4-SNAPSHOT"]] :figwheel {:http-server-root "public" :port 3449 :css-dirs ["resources/public/css"]} :env {:is-dev true} :cljsbuild {:builds {:app {:source-paths ["env/dev/cljs"]}}}} :uberjar {:hooks [leiningen.cljsbuild] :env {:production true} :omit-source true :aot :all :cljsbuild {:builds {:app {:source-paths ["env/prod/cljs"] :compiler {:optimizations :advanced :pretty-print false }}}}}})
2 (defproject pomodoro "0.0.4" :license {:name "MIT" :url "http://opensource.org/licenses/MIT" :distribution :repo} :description "A simple pomodoro timer" :url "https://github.com/landau/cljs-pomodoro" :dependencies [[org.clojure/clojure "1.6.0"] [org.clojure/clojurescript "0.0-2322"] [org.clojure/core.async "0.1.338.0-5c5012-alpha"] [com.andrewmcveigh/cljs-time "0.1.6"] [reagent "0.4.2"]] :plugins [[lein-ring "0.8.11"] [lein-cljsbuild "1.0.3"] [lein-environ "0.5.0"]] :ring {:handler server.core/app} :profiles {:uberjar {:aot :all} :dev {:dependencies [[ring-mock "0.1.5"] [ring/ring-devel "1.3.0"] [compojure "1.1.9"]] :env {:dev true}} :release {:ring {:open-browser? false :stacktraces? false :auto-reload? false}}} :source-paths ["src"] :main server.core :cljsbuild { :builds [{:id "dev" :source-paths ["src-cljs"] :compiler {:output-to "public/js/pomodoro.js" :output-dir "public/js/dev" :optimizations :none :pretty-print tru :source-map true}} {:id "prod" :source-paths ["src-cljs"] :compiler {:output-to "public/js/main.js" :optimizations :advanced :pretty-print false :externs ["public/js/react-min-0.11.2.js"] }}]})
3 (defproject datascript-mori "0.15.2" :description "Wrapper for datascript interplay mori" :url "https://github.com/typeetfunc/datascript-mori" :license {:name "Eclipse Public License" :url "http://www.eclipse.org/legal/epl-v10.html"} :min-lein-version "2.5.3" :dependencies [[org.clojure/clojure "1.7.0"] [org.clojure/clojurescript "1.7.170"] [datascript "0.15.0"]] :plugins [[lein-cljsbuild "1.1.2" :exclusions [[org.clojure/clojure]]] [lein-git-deps "0.0.2-SNAPSHOT"]] :git-dependencies [["https://github.com/swannodette/mori.git"]] :source-paths ["src" ".lein-git-deps/mori/src"] :clean-targets ^{:protect false} ["target"] :cljsbuild {:builds [{:id "min" :source-paths ["src" ".lein-git-deps/mori/src"] :compiler { :output-to "release-js/datascript-mori.bare.js" :main datascript-mori.core :optimizations :advanced :pretty-print false } :notify-command ["release-js/wrap_bare.sh"]}]} )
4 (defproject pandect "0.6.1-SNAPSHOT" :description "Message Digest and Checksum Library for Clojure" :url "https://github.com/xsc/pandect" :license {:name "MIT License" :url "https://opensource.org/licenses/MIT" :year 2014 :key "mit"} :dependencies [[org.clojure/clojure "1.8.0" :scope "provided"] [org.bouncycastle/bcprov-jdk15on "1.54" :scope "provided"]] :exclusions [org.clojure/clojure] :source-paths ["src/clojure" "target/generated"] :java-source-paths ["src/java"] :profiles {:dev {:plugins [[lein-codox "0.9.4"]] :codox {:project {:name "pandect"} :metadata {:doc/format :markdown} :output-path "doc" :namespaces [pandect.core pandect.buffer #"^pandect\.algo\.[a-z\-]+"]}} :benchmark {:dependencies [[criterium "0.4.3"] [clj-message-digest "1.0.0"] [digest "1.4.4"]] :source-paths ["shootout"] :jvm-opts ^:replace ["-Xmx1g" "-server"]} :1.5 {:dependencies [[org.clojure/clojure "1.5.1"]]} :1.6 {:dependencies [[org.clojure/clojure "1.6.0"]]} :1.7 {:dependencies [[org.clojure/clojure "1.7.0"]]}} :prep-tasks ["codegen"] :aliases {"benchmark" ["with-profile" "dev,benchmark" "run" "-m"] "codegen" ["run" "-m" "pandect.codegen"] "all" ["with-profile" "+dev:+1.5:+1.6:+1.7"]} :pedantic? :abort)
5 (defproject stch-library/sql "0.1.1" :description "A DSL in Clojure for SQL query, DML, and DDL." :url "https://github.com/stch-library/sql" :license {:name "Eclipse Public License" :url "http://www.eclipse.org/legal/epl-v10.html"} :dependencies [[org.clojure/clojure "1.5.1"] [stch-library/schema "0.3.3"]] :profiles {:dev {:dependencies [[speclj "3.0.2"]]}} :plugins [[speclj "3.0.2"] [codox "0.6.7"]] :codox {:src-dir-uri "https://github.com/stch-library/sql/blob/master/" :src-linenum-anchor-prefix "L"} :test-paths ["spec"])
6 (defproject laboratory "0.1.0-SNAPSHOT" :description "do science in production" :url "https://github.com/yeller/laboratory" :license {:name "Eclipse Public License" :url "http://www.eclipse.org/legal/epl-v10.html"} :dependencies [[org.clojure/clojure "1.8.0"]] :profiles {:dev {:dependencies [[org.clojure/tools.namespace "0.2.4"]]} :benches {:dependencies [[criterium "0.4.1"]] :source-paths ["src" "benches"]}} :global-vars {*warn-on-reflection* true *unchecked-math* :warn-on-boxed ;*compiler-options* {:disable-locals-clearing true} *assert* true})
/g means that you want to extract all matches, not just one which is what REGEXP_EXTRACT does.
You should use REGEXP_EXTRACT_ALL instead, along with UNNEST
So try below
#standardSQL
SELECT deps
FROM `my-test-23.lab.clj_project_files`,
UNNEST(REGEXP_EXTRACT_ALL(content, r' :dependencies \[(.*?)\]] ')) AS deps
got "Query returned zero records" ....
Try below with dummy data based on your example (just stripped first two rows)
#standardSQL
WITH yourTable AS (
SELECT 1 AS id, '(defproject :dependencies [[org.clojure/clojure "1.6.0"] [org.clojure/clojurescript "0.0-2371" :scope "provided"] [org.clojure/core.async "0.1.346.0-17112a-alpha"] [ring "1.3.1"] [compojure "1.2.0"] [enlive "1.1.5"] [om "0.7.3"] [figwheel "0.1.4-SNAPSHOT"] [environ "1.0.0"] [com.cemerick/piggieback "0.1.3"] [weasel "0.4.3-SNAPSHOT"] [leiningen "2.5.0"] [http-kit "2.1.19"] [com.cognitect/transit-cljs "0.8.188"] ; [devcards "0.1.2-SNAPSHOT"] [sablono "0.2.22"] [prismatic/om-tools "0.3.3"]] :plugins [[lein-cljsbuild "1.0.3"] [lein-environ "1.0.0"]] ' AS content UNION ALL
SELECT 2, '(defproject :dependencies [[org.clojure/clojure "1.6.0"] [org.clojure/clojurescript "0.0-2322"] [org.clojure/core.async "0.1.338.0-5c5012-alpha"] [com.andrewmcveigh/cljs-time "0.1.6"] [reagent "0.4.2"]] :plugins [[lein-ring "0.8.11"] [lein-cljsbuild "1.0.3"] [lein-environ "0.5.0"]] :ring {:handler server.core/app} :profiles {:uberjar {:aot :all} :dev {:dependencies [[ring-mock "0.1.5"] [ring/ring-devel "1.3.0"] [compojure "1.1.9"]] :env {:dev true}} '
)
SELECT id, deps
FROM yourTable, UNNEST(SPLIT(REPLACE(
REGEXP_EXTRACT(content, r' :dependencies \[(\[.*?])*] ')
,'] [', '],['))) AS deps
ORDER BY id
Result is as below
Row id deps
1 1 [org.clojure/clojurescript "0.0-2371" :scope "provided"]
2 1 [prismatic/om-tools "0.3.3"]
3 1 [sablono "0.2.22"]
4 1 [com.cognitect/transit-cljs "0.8.188"] ; [devcards "0.1.2-SNAPSHOT"]
5 1 [http-kit "2.1.19"]
6 1 [leiningen "2.5.0"]
7 1 [weasel "0.4.3-SNAPSHOT"]
8 1 [com.cemerick/piggieback "0.1.3"]
9 1 [environ "1.0.0"]
10 1 [figwheel "0.1.4-SNAPSHOT"]
11 1 [om "0.7.3"]
12 1 [enlive "1.1.5"]
13 1 [compojure "1.2.0"]
14 1 [ring "1.3.1"]
15 1 [org.clojure/core.async "0.1.346.0-17112a-alpha"]
16 1 [org.clojure/clojure "1.6.0"]
17 2 [org.clojure/clojure "1.6.0"]
18 2 [org.clojure/clojurescript "0.0-2322"]
19 2 [org.clojure/core.async "0.1.338.0-5c5012-alpha"]
20 2 [com.andrewmcveigh/cljs-time "0.1.6"]
21 2 [reagent "0.4.2"]
... but if I remove that and run it on my own dataset/table I don't get any results ...
Looks like your real data is "slightly" different from how it shown in your question
Try below - it should work now :o)
#standardSQL
SELECT id, deps
FROM `my-test-23.lab.clj_project_files`,
UNNEST(SPLIT(REGEXP_REPLACE(
REGEXP_EXTRACT(content, r'(?s) :dependencies \[(\[.*?])]')
, r']\n *\[', '],['))) AS deps
ORDER BY id
I am working on a Reagent project, and seem to not be able to use a macros.clj file. No matter where I put it, it keeps giving me the same message: "could not locate macros/core__init.class or macros/core.clj on classpath. Where should I be putting my macros.clj file, or what am I missing?
The structure is as follows:
test-proj/
env/
dev/
clj/
test-proj/
middleware.clj
repl.clj
cljs/
test-proj/
dev.cljs
prod/
clj/
test-proj/
middleware.clj
cljs/
test-proj/
prod.cljs
resources/
public/
css/
site.css
src/
clj/
test-proj/
handler.clj
server.clj
cljc/
test-proj/
util.cljc
cljs/
test-proj/
bmi.cljs
core.cljs
home.cljs
macros.clj
simple-examples.cljs
timer.cljs
todo.cljs
target/
classes/
META-INF/
maven/
test-proj/
test/proj/
pom.properties
cljsbuild/
public/
js/
out/
...
app.js
stale/
leiningen.core.classpath.extract-native-dependencies
leiningen.figwheel.clean-on-dependency-change
figwheel_server.log
LICENSE
Procfile
project.clj
README.md
system.properties
The namespace in my core.cljs file looks as such:
(ns test-proj.core
(:require [reagent.core :as reagent :refer [atom]]
[reagent.session :as session]
[secretary.core :as secretary :include-macros true]
[accountant.core :as accountant]
[home.core :as h]
[simple-examples.core :as se]
[bmi.core :as b]
[timer.core :as t]
[todo.core :as td])
(:require-macros [macros.core :as m]))
The namespace for my macros.core looks as follows:
(ns macros.core)
My project.clj file looks as follows:
(defproject test-proj "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [[org.clojure/clojure "1.8.0"]
[ring-server "0.4.0"]
[reagent "0.6.0"]
[reagent-utils "0.2.0"]
[ring "1.5.0"]
[ring/ring-defaults "0.2.1"]
[compojure "1.5.1"]
[hiccup "1.0.5"]
[yogthos/config "0.8"]
[org.clojure/clojurescript "1.9.473"
:scope "provided"]
[secretary "1.2.3"]
[venantius/accountant "0.1.7"
:exclusions [org.clojure/tools.reader]]]
:plugins [[lein-environ "1.0.2"]
[lein-cljsbuild "1.1.1"]
[lein-ring "0.11.0"]
[lein-asset-minifier "0.2.7"
:exclusions [org.clojure/clojure]]]
:ring {:handler test-proj.handler/app
:uberwar-name "test-proj.war"}
:min-lein-version "2.5.0"
:uberjar-name "test-proj.jar"
:main test-proj.server
:clean-targets ^{:protect false}
[:target-path
[:cljsbuild :builds :app :compiler :output-dir]
[:cljsbuild :builds :app :compiler :output-to]]
:source-paths ["src/clj" "src/cljc"]
:resource-paths ["resources" "target/cljsbuild"]
:minify-assets
{:assets
{"resources/public/css/site.min.css" "resources/public/css/site.css"}}
:cljsbuild
{:builds {:min
{:source-paths ["src/cljs" "src/cljc" "env/prod/cljs"]
:compiler
{:output-to "target/cljsbuild/public/js/app.js"
:output-dir "target/uberjar"
:optimizations :advanced
:pretty-print false}}
:app
{:source-paths ["src/cljs" "src/cljc" "env/dev/cljs"]
:compiler
{:main "test-proj.dev"
:asset-path "/js/out"
:output-to "target/cljsbuild/public/js/app.js"
:output-dir "target/cljsbuild/public/js/out"
:source-map true
:optimizations :none
:pretty-print true}}
}
}
:figwheel
{:http-server-root "public"
:server-port 3449
:nrepl-port 7002
:nrepl-middleware ["cemerick.piggieback/wrap-cljs-repl"
]
:css-dirs ["resources/public/css"]
:ring-handler test-proj.handler/app}
:profiles {:dev {:repl-options {:init-ns test-proj.repl
:nrepl-middleware [cemerick.piggieback/wrap-cljs-repl]}
:dependencies [[ring/ring-mock "0.3.0"]
[ring/ring-devel "1.5.0"]
[prone "1.1.4"]
[figwheel-sidecar "0.5.8"]
[org.clojure/tools.nrepl "0.2.12"]
[com.cemerick/piggieback "0.2.2-SNAPSHOT"]
[pjstadig/humane-test-output "0.8.1"]
]
:source-paths ["env/dev/clj"]
:plugins [[lein-figwheel "0.5.8"]
]
:injections [(require 'pjstadig.humane-test-output)
(pjstadig.humane-test-output/activate!)]
:env {:dev true}}
:uberjar {:hooks [minify-assets.plugin/hooks]
:source-paths ["env/prod/clj"]
:prep-tasks ["compile" ["cljsbuild" "once" "min"]]
:env {:production true}
:aot :all
:omit-source true}})
The error:
---- Could not Analyze src/cljs/test-proj/core.cljs ----
Could not locate macros/core__init.class or macros/core.clj on classpath.
---- Analysis Error : Please see src/cljs/test-proj/core.cljs ----
To use macros from Clojurescript:
(ns my.namespace
(:require-macros [my.macros :as my]))
Here's the documentation: https://github.com/clojure/clojurescript/wiki/Differences-from-Clojure#macros
I have just run lein cljsbuild once in my lein project directory, and I got the error java.lang.IllegalStateException : Can't dynamically bind non-dynamic var: clojure.tools.reader/resolve-symbol
Stacktrace:
https://gist.githubusercontent.com/fyquah95/0a02b06c0a9aa2225f9c/raw/0cc05629a18c3711e27b1fc9dd59db0532d964b8/gistfile1.txt
My project.clj file:
(defproject barclays-cycle-hire-stats "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:main barclays-cycle-hire-stats.core
:plugins [[lein-cljsbuild "1.0.6"]
[lein-ring "0.8.7"]]
:source-paths ["src/clj"]
:cljsbuild {
:builds [{:source-paths ["src/cljs"]
:compiler {:output-to "resources/public/js/main.js"
:optimizations :whitespace
:pretty-print true}}]}
:dependencies [[http-kit "2.1.18"]
[reagent "0.5.1-rc"]
[cljs-ajax "0.3.14"]
[compojure "1.1.6"]
[hiccup "1.0.4"]
[org.clojure/math.numeric-tower "0.0.4"]
; [org.clojure/clojure.core.async "0.1.346.0-17112a-alpha"]
[spyscope "0.1.5"]
[org.clojure/math.combinatorics "0.1.1"]
[org.clojure/data.json "0.2.6"]
[org.clojure/clojure "1.7.0"]
[org.clojure/clojurescript "1.7.48" :exclusion [org.clojure/data.json]]
[org.clojure/data.csv "0.1.3"]]
:eval-in-leiningen true
:ring {:handler barclays-cycle-hire-stats.routes/app})
Try without :eval-in-leiningen true.
:eval-in-leiningen is intended for plugins, and it's a source of weird errors when used in a project.
You can find information about :eval-in-leiningen and :eval-in-project in the Project isolation section of leiningen.core doc, and Plugins doc of leiningen
Adding :exclusions [org.apache.ant/ant] to clojurescript dependency fixed the same error message for me. So it looks like this:
[org.clojure/clojurescript "1.7.48" :exclusions [org.apache.ant/ant]]
I'm running lein figwheel + reagent, and while the the site seems to be updating, I can't track down what would cause the following stacktrace. Is there anyplace I should look? What does this error mean?
lein figwheel
Figwheel: focusing on build-id 'app'
Compiling ClojureScript.
Figwheel: Starting server at http://localhost:3449
Figwheel: Serving files from '(dev-resources|resources)/public'
Compiling "resources/public/js/app.js" from ("src/cljs" "env/dev/cljs")...
Compiling "resources/public/js/app.js" failed.
java.lang.NullPointerException:
closure.clj:325 cljs.closure/compiled-file
core.clj:2557 clojure.core/map[fn]
LazySeq.java:40 clojure.lang.LazySeq.sval
LazySeq.java:49 clojure.lang.LazySeq.seq
RT.java:484 clojure.lang.RT.seq
core.clj:133 clojure.core/seq
core.clj:685 clojure.core/concat[fn]
LazySeq.java:40 clojure.lang.LazySeq.sval
LazySeq.java:49 clojure.lang.LazySeq.seq
RT.java:484 clojure.lang.RT.seq
core.clj:133 clojure.core/seq
core.clj:685 clojure.core/concat[fn]
LazySeq.java:40 clojure.lang.LazySeq.sval
LazySeq.java:49 clojure.lang.LazySeq.seq
Cons.java:39 clojure.lang.Cons.next
RT.java:1654 clojure.lang.RT.boundedLength
RestFn.java:130 clojure.lang.RestFn.applyTo
core.clj:626 clojure.core/apply
closure.clj:993 cljs.closure/build
core.clj:170 clojurescript-build.core/build-source-paths
auto_builder.clj:59 figwheel-sidecar.auto-builder/autobuild[fn]
auto_builder.clj:52 figwheel-sidecar.auto-builder/autobuild
form-init495530074882707163.clj:1 user/eval12375
Compiler.java:6703 clojure.lang.Compiler.eval
Compiler.java:6693 clojure.lang.Compiler.eval
Compiler.java:7130 clojure.lang.Compiler.load
Compiler.java:7086 clojure.lang.Compiler.loadFile
main.clj:274 clojure.main/load-script
main.clj:279 clojure.main/init-opt
main.clj:307 clojure.main/initialize
main.clj:342 clojure.main/null-opt
main.clj:420 clojure.main/main
RestFn.java:421 clojure.lang.RestFn.invoke
Var.java:383 clojure.lang.Var.invoke
AFn.java:156 clojure.lang.AFn.applyToHelper
Var.java:700 clojure.lang.Var.applyTo
main.java:37 clojure.main.main
Here's my project.clj:
(defproject project-name "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:source-paths ["src/clj" "src/cljs"]
:dependencies [[org.clojure/clojure "1.6.0"]
[com.facebook/react "0.11.2"]
[reagent "0.5.0-alpha"]
[reagent-utils "0.1.0"]
[secretary "1.2.1"]
[org.clojure/clojurescript "0.0-2496" :scope "provided"]
[com.cemerick/piggieback "0.1.3"]
[weasel "0.4.2"]
[ring "1.3.2"]
[ring/ring-defaults "0.1.2"]
[prone "0.8.0"]
[compojure "1.3.1"]
[selmer "0.7.7"]
[environ "1.0.0"]
[leiningen "2.5.0"]
[figwheel "0.1.5-SNAPSHOT"]
[cljs-ajax "0.3.3"]]
:plugins [[cider/cider-nrepl "0.8.2"]
[lein-cljsbuild "1.0.3"]
[lein-environ "1.0.0"]
[lein-ring "0.8.13"]
[lein-asset-minifier "0.2.0"]]
:ring {:handler homing-pigeon.handler/app}
:min-lein-version "2.5.0"
:uberjar-name "homing-pigeon.jar"
:minify-assets
{:assets
{"resources/public/css/site.min.css" "resources/public/css/site.css"}}
:cljsbuild {:builds {:app {:source-paths ["src/cljs"]
:compiler {:output-to "resources/public/js/app.js"
:output-dir "resources/public/js/out"
:externs ["react/externs/react.js"]
:optimizations :none
:pretty-print true}}}}
:profiles {:dev {:repl-options {:init-ns homing-pigeon.handler
:nrepl-middleware [cemerick.piggieback/wrap-cljs-repl]}
:dependencies [[ring-mock "0.1.5"]
[ring/ring-devel "1.3.2"]
[pjstadig/humane-test-output "0.6.0"]]
:plugins [[lein-figwheel "0.2.0-SNAPSHOT"]]
:injections [(require 'pjstadig.humane-test-output)
(pjstadig.humane-test-output/activate!)]
:figwheel {:http-server-root "public"
:server-port 3449
:css-dirs ["resources/public/css"]
:ring-handler homing-pigeon.handler/app}
:env {:dev? true}
:cljsbuild {:builds {:app {:source-paths ["env/dev/cljs"]
:compiler {:source-map true}}}}}
:uberjar {:hooks [leiningen.cljsbuild minify-assets.plugin/hooks]
:env {:production true}
:aot :all
:omit-source true
;;TODO: figure out how to clean properly
;:prep-tasks [["cljsbuild" "clean"]]
:cljsbuild {:jar true
:builds {:app
{:source-paths ["env/prod/cljs"]
:compiler
{:optimizations :advanced
:pretty-print false}}}}}
:production {:ring {:open-browser? false
:stacktraces? false
:auto-reload? false}}})
I found the problem.
I had an empty file in core/rules.cljs, and the compiler was erorring out over it.