(Postgrex.Error)错误58P01(undefined_file)$ libdir / postgis-2.4

时间:2019-01-04 06:10:24

标签: elixir postgis ecto elixir-framework postgrex

我不得不冲泡重新安装现有项目使用的某些东西。

现在,当我运行SELECT语句时出现此错误:

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

它在抱怨PostGis。我做了brew install postgis来重新安装它。仍然出现错误。 Macbook中的$libdir目录在哪里,以便我可以查看文件?如何解决此错误?

1 个答案:

答案 0 :(得分:0)

问题是我的postGis和postgresql版本不兼容(我曾经用brew install xxx来获得两者)。

因此,我刚刚从计算机上卸载了所有postgresqlpostgis版本:brew uninstall postgresqlbrew uninstall postgis

brew list仍列出了postgresql的一种版本:

postgresql9.4

所以我卸载了该版本:

brew uninstall postgresql9.4

然后,我使用postgres.app downloads下载并安装了postgresql和postgis,因为它将它们放在一起并且始终兼容。

我专门下载了“带有PostgreSQL 10的旧版Postgres.app”,因为这是我在此应用程序上的全部开发工作。

下载后请按照https://postgresapp.com/上的说明进行安装。