Starting a ClojureScript Project in 2022

I needed to start a simple ClojureScript project in 2022. And it was a faff.

I love Clojure. But creating projects has become much harder because of so many different ways to do it, different and changing tools, and outdated online documentation.

So tl;dr:

I seem to have found a solution that works for me. August 19, 2022

Step 1: Make sure you have up-to-date Clojure CLI tools.

I had Clojure 1.10.1 and none of the tutorials I found worked; and just got incomprehensible error messages.

If you ever see an error message like :

-T is no longer supported, use -A with repl, -M for main, or -X for exec

That’s a definite sign you have an outdated version.

I had 1.10.1 because that’s the current Ubuntu version. It’s outdated, so install CLI yourself. You want 1.11.1 (as of time of writing)

I used

curl -O https://download.clojure.org/install/linux-install-1.11.1.1155.sh
chmod +x linux-install-1.11.1.1155.sh
sudo ./linux-install-1.11.1.1155.sh

Check your version with

clj -Mtools

Step 2: Install clj-new

Useful tool or library from Sean Corfield

See https://github.com/seancorfield/clj-new

Step 3 : Using clj-new install from the figwheel-main template.

clojure -Tclj-new create :template figwheel-main :name myname/myapp :args '["+deps","–reagent"]'

Then run the app with

clojure -M:fig:build

I hope this helps anyone else with similar confusion to me.

For a long discussion / pleading / ranting, see https://clojureverse.org/t/starting-a-new-clojurescript-project-in-2022-setup-suggestions/9222/18 and https://clojureverse.org/t/the-further-adventures-of-starting-a-new-clojurescript-project-in-2022/9228 . And thanks to everyone on Clojureverse who took time and patience to help me get this working.

Leave a comment