1

I had to brew reinstall some things that my existing project uses.

Now I'm getting this error when I'm running a SELECT statement:

Interactive Elixir (1.7.4) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)>
18:07:23.636 [debug] QUERY ERROR source="shops" db=5.4ms
SELECT s0."id", s0."name", s0."place_id", s0."point", s0."inserted_at", s0."updated_at",ST_Distance_Sphere(s0."point", ST_SetSRID(ST_MakePoint($1,$2), $3)) FROM "shops" AS s0 WHERE (ST_DWithin(s0."point"::geography, ST_SetSRID(ST_MakePoint($4, $5), $6), $7)) ORDER BY s0."point" <-> ST_SetSRID(ST_MakePoint($8,$9), $10) [176.1666197, -37.6741546, 4326, 176.1666197, -37.6741546, 4326, 2000, 176.1666197, -37.6741546, 4326]

18:07:23.666 [error] #PID<0.356.0> running Api.Router terminated
Server: 192.168.20.9:4000 (http)
Request: GET /products?categories[]=1&categories[]=2&categories[]=3&categories[]=4&categories[]=5&categories[]=6&categories[]=7&categories[]=8&categories[]=9&categories[]=10&categories[]=11&categories[]=12&categories[]=13&categories[]=14&categories[]=15&categories[]=16&categories[]=17&categories[]=18&categories[]=19&categories[]=20&categories[]=21&categories[]=22&categories[]=23&categories[]=24&categories[]=25&keyword=%22%22&latitude=-37.6741546&longitude=176.1666197&distanceFromLocationValue=2&distanceFromLocationUnit=%22kilometers%22
** (exit) an exception was raised:
    ** (Postgrex.Error) ERROR 58P01 (undefined_file): could not access file "$libdir/postgis-2.4": No such file or directory
        (ecto) lib/ecto/adapters/sql.ex:436: Ecto.Adapters.SQL.execute_and_cache/7
        (ecto) lib/ecto/repo/queryable.ex:130: Ecto.Repo.Queryable.execute/5
        (ecto) lib/ecto/repo/queryable.ex:35: Ecto.Repo.Queryable.all/4
        (api) lib/api/controllers/product/get_product.ex:46: Api.Controllers.GetProduct.get_products/1
        (api) lib/api/router.ex:1: Api.Router.plug_builder_call/2
        (api) lib/plug/debugger.ex:123: Api.Router.call/2
        (plug) lib/plug/adapters/cowboy/handler.ex:15: Plug.Adapters.Cowboy.Handler.upgrade/4
        (cowboy) /Users/Ben/Development/Projects/vepo/api/deps/cowboy/src/cowboy_protocol.erl:442: :cowboy_protocol.execute/4

It is complaining about PostGis. I did brew install postgis to install it again. Still getting the error. Where is $libdirdirectory in my macbook so that I can view the files? How do I fix this error?

BeniaminoBaggins
  • 11,202
  • 41
  • 152
  • 287

1 Answers1

0

The issue was that my versions of postGis and postgresql were incompatible (I had used brew install xxx to get them both).

So I just uninstalled all postgresql and postgis versions from my computer: brew uninstall postgresql and brew uninstall postgis

brew list still listed one version of postgresql:

postgresql9.4

So I uninstalled that version:

brew uninstall postgresql9.4

Then I used postgres.app downloads to download and install postgresql and postgis, because it gets them both together and they are always compatible.

I specifically went for the "Legacy Postgres.app with PostgreSQL 10" download because that is what I was using all through my development on this app.

Use instructions at https://postgresapp.com/ to install it after it is downloaded.

BeniaminoBaggins
  • 11,202
  • 41
  • 152
  • 287
  • So this is a story about _“why one should never use MacOS for development”_ that basically has nothing to do with [tag:elixir], [tag:ecto] and [tag:postgrex]. – Aleksei Matiushkin Jan 05 '19 at 06:19