Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I have an error in Clojure and leiningen command

I am working on a project in Clojure. I tried to migrate my latest DB commit to my local using the command

PROFILE=dev lein ragtime migrate

Getting this error:

clojure.lang.Compiler$CompilerException: Syntax error macroexpanding clojure.core/fn at (clojure/core/unify.clj:83:18).

:clojure.error{:phase :macro-syntax-check, :line 83, :column 18, :source "clojure/core/unify.clj", :symbol clojure.core/fn}

like image 261
Nandu Nandan Avatar asked Mar 01 '19 16:03

Nandu Nandan


People also ask

What is Leiningen build system in Clojure?

Introduction Leiningen is a modern build system for our Clojure projects. It's also written and configured entirely in Clojure. It works similarly to Maven, giving us a declarative configuration that describes our project, without needing to configure exact steps to be executed.

Where can I find the namespace of a Clojure project?

Note that the main source namespace is my-project.core, and is found in the file my_project/core.clj. It's discouraged in Clojure to use single-segment namespaces – the equivalent of top-level classes in a Java project.

Can I have multiple versions of Clojure on the same system?

Also, notice that Clojure is just a dependency here. This makes it trivial to write projects using whatever version of the Clojure libraries are desired, and especially to have multiple different versions running on the same system.

How do I create a new project in Leiningen?

Creating a New Project Once Leiningen is installed, we can use it to create a new project by invoking lein new. This creates a project using a particular template from a set of options: For example, to create a new application called “my-project” we would execute:


Video Answer


2 Answers

I also encountered this issue with Leiningen 2.9.1. In my case it turned out to occur due to the lein-ring plugin which depends on an outdated unify version. The issue is already fixed in the newest lein-ring version though: https://github.com/weavejester/lein-ring/issues/203. So upgrading lein-ring to 0.12.5 fixed it for me.

like image 162
David Ongaro Avatar answered Sep 20 '22 18:09

David Ongaro


I'm not 100% sure what this issue is, but it seems to be related to leiningen 2.9.x.

At first, I ran leiningen v 2.8.x (don't remember which version exactly). Then everything worked fine.

Then I updated leiningen to 2.9.1, and I got this error the next time I tried to build with leiningen.

We then updated ring from version 1.4.0 to 1.7.1, and the error disappeared.

Alternatively, if you have to use an old version of a library, the only fix seems to be to downgrade to leiningen 2.8:

lein upgrade 2.8.3
like image 40
August Lilleaas Avatar answered Sep 24 '22 18:09

August Lilleaas