Create ANVIL local server on Windows11 problem

I am trying to create ANVIL local server on my Windows11 PC.

I followed anvil-runtime/README.md at master · anvil-works/anvil-runtime · GitHub
instructions.

I tried to run todo-list template.
But when I run anvil-app-server I got errors.

My java versions are:
openjdk version “21.0.6” 2025-01-21 LTS
OpenJDK Runtime Environment Corretto-21.0.6.7.1 (build 21.0.6+7-LTS)
OpenJDK 64-Bit Server VM Corretto-21.0.6.7.1 (build 21.0.6+7-LTS, mixed mode, sharing)

Python version: Python 3.12.6

The error I get is:

Found Anvil App Server JAR in package directory
[INFO anvil.app-server.postgres] Launching embedded Postgres database. Find Postgres daemon logs in the ’ .anvil-data ’ directory.
java.util.concurrent.ExecutionException: java.lang.IllegalStateException: Process [.anvil-data\db-bin\PG-3ecc125de4870fe95f7f29f11aba3613\bin\initdb.exe, -A, trust, -U, postgres, -D, .anvil-data\db, -E, UTF-8] failed
at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:191)
at clojure.core$deref_future.invokeStatic(core.clj:2317)
at clojure.core$future_call$reify__8544.deref(core.clj:7042)
at clojure.core$deref.invokeStatic(core.clj:2337)
at clojure.core$deref.invoke(core.clj:2323)
at anvil.app_server.postgres$start_postgres_with_timeout.invokeStatic(postgres.clj:47)
at anvil.app_server.postgres$start_postgres_with_timeout.invoke(postgres.clj:37)
at anvil.app_server.postgres$launch_bundled_db_BANG_.invokeStatic(postgres.clj:146)
at anvil.app_server.postgres$launch_bundled_db_BANG_.invoke(postgres.clj:87)
at anvil.app_server.run$with_bundled_postgres_if_configured.invokeStatic(run.clj:319)
at anvil.app_server.run$with_bundled_postgres_if_configured.invoke(run.clj:312)
at anvil.app_server.run$with_bundled_postgres_if_configured.invokeStatic(run.clj:313)
at anvil.app_server.run$with_bundled_postgres_if_configured.invoke(run.clj:312)
at anvil.app_server.run$_main.invokeStatic(run.clj:418)
at anvil.app_server.run$_main.doInvoke(run.clj:414)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at anvil.app_server.run.main(Unknown Source)
Caused by: java.lang.IllegalStateException: Process [.anvil-data\db-bin\PG-3ecc125de4870fe95f7f29f11aba3613\bin\initdb.exe, -A, trust, -U, postgres, -D, .anvil-data\db, -E, UTF-8] failed
at io.zonky.test.db.postgres.embedded.EmbeddedPostgres.system(EmbeddedPostgres.java:632)
at io.zonky.test.db.postgres.embedded.EmbeddedPostgres.initdb(EmbeddedPostgres.java:252)
at io.zonky.test.db.postgres.embedded.EmbeddedPostgres.(EmbeddedPostgres.java:159)
at io.zonky.test.db.postgres.embedded.EmbeddedPostgres$Builder.start(EmbeddedPostgres.java:583)
at anvil.app_server.postgres$start_postgres_with_timeout$fn__527.invoke(postgres.clj:39)
at clojure.core$binding_conveyor_fn$fn__5823.invoke(core.clj:2047)
at clojure.lang.AFn.call(AFn.java:18)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
at java.base/java.lang.Thread.run(Thread.java:1583)
Failed to start built-in Postgres database: java.util.concurrent.ExecutionException: java.lang.IllegalStateException: Process [.anvil-data\db-bin\PG-3ecc125de4870fe95f7f29f11aba3613\bin\initdb.exe, -A, trust, -U, postgres, -D, .anvil-data\db, -E, UTF-8] failed
More logs are available in .anvil-data\postgres.log.
Some common causes of this problem:

  • Are you launching this server as ‘root’ on a UNIX system?
    Postgres will not run as root; try launching the server as an ordinary user.
  • Are you running this server on an unusual architecture or OS? (Windows 11/amd64)

I searched the forum and didn’t find a solution.

By the way I tried to run it with WSL and it worked.

1 Like

Last time I tried it, I got an error message about the server not working in windows 11 specifically and that it’s a non quantity (WSL excluded). So, this is something they actually have to make compatible.

Have you tried running in an environment with Python 3.11? I’ve been stuck on version 1.7.3 of anvil-app-server for a long time (because of organizational requirements where it’s installed in existing projects), so I can’t speak about the most recent version, but that runs well in Windows 11. You do in some cases need to install MS C++ 2013 redistributable, as in the solution here: Anvil App Server; Failed to start built-in Postgres database - #4 by tomaz.turk

Thanks. I installed the MS C++ 2013 redistributable and it worked.

FYI