1

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

现在,当我运行 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,以便我可以查看文件?如何修复此错误?

4

1 回答 1

0

问题是我的 postGis 和 postgresql 版本不兼容(我曾经brew install xxx同时获得它们)。

所以我刚刚从我的电脑上卸载了所有版本:postgresqlpostgisbrew uninstall postgresqlbrew uninstall postgis

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

postgresql9.4

所以我卸载了那个版本:

brew uninstall postgresql9.4

然后我使用postgres.app 下载来下载和安装 postgresql 和 postgis,因为它将它们结合在一起并且它们总是兼容的。

我专门下载了“Legacy Postgres.app with PostgreSQL 10”下载,因为这是我在这个应用程序的开发过程中一直使用的。

下载后使用https://postgresapp.com/上的说明进行安装。

于 2019-01-04T20:10:37.947 回答