代码之家  ›  专栏  ›  技术社区  ›  BeniaminoBaggins

(Postgrex.Error)错误58P01(未定义的_文件)$libdir/postgis-2.4

  •  0
  • BeniaminoBaggins  · 技术社区  · 6 年前

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

    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
    

    $libdir 我的macbook中的目录,以便我可以查看文件?如何修复此错误?

    1 回复  |  直到 6 年前
        1
  •  0
  •   BeniaminoBaggins    6 年前

    问题是我的postGis和postgresql版本不兼容(我使用了 brew install xxx 把它们都弄到手)。

    所以我刚刚卸载了所有 postgresql postgis “我的电脑”的版本: brew uninstall postgresql brew uninstall postgis

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

    postgresql9.4

    因此,我卸载了该版本:

    brew uninstall postgresql9.4

    然后我用 postgres.app downloads

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

    使用说明在 https://postgresapp.com/ 下载后再安装。