Web Development with Clojure, Third Edition: (create-migration "guestbook") not working (page 9)

When I try the command to create a pair of migration files I get an error.

user=> (create-migration "guestbook")
Execution error (IllegalArgumentException) at user/create-migration (user.clj:61).
find not supported on type: mount.core.DerefableState

user=>

Linux Ubuntu 20.04 LTS, OpenJDK 14.0.2

1 Like

This is probably because you haven’t mounted the DB by starting the app.

(in-ns 'guestbook.user)
(start)
(create-migration "foo")
1 Like

Thank you, I tried that and it worked.

Hopefully that can be added to the instructions in the book so that people like me who are learning Clojure as they are learning how to make web apps using it can be less confused.

2 Likes

Dmitri Sotnikov @dmitri and Scot Brown @svmbrown

Working through this now and encountered same issue, so thanks for this thread!

In addition, I found on p. 9

A common beginner error that you may encounter is forgetting to start the
database connection. If you do get this error, don’t worry—just run (start) and try again. In fact, any error that mentions mount.core.DerefableState is probably due to forgetting to run (start).

But I agree. There should be an additional sentence telling the reader to not only start the REPL (which it does) but to also ‘(start)’ especially since we are a long way from p. 9!

1 Like

Thank you, @bmads_51 !

I am on page 163 and I was trying to figure out how create-migration worked the last time I used it.
As you said, this is a long distance away from page 9. It would indeed be helpful to mention the need to run (start) after starting up the REPL (which I interpreted as just running lein repl).

Unfortunately, it is difficult for me to make time for working through this book, so I am usually picking things up after a week of solving other problems and giving my attention to other things.

I really appreciate the efforts of this community to help each other!