【问题标题】:Heroku pg:pull is giving sh: createdb: command not foundHeroku pg:pull 给出 sh: createdb: command not found
【发布时间】:2014-08-10 11:42:13
【问题描述】:

当我尝试执行 heroku pg:pull DATABASE_URL myappspassword 时,我收到此错误:

my-computer:a-folder (master*) · heroku pg:pull DATABASE_URL myappspassword
 !    sh: createdb: command not found
 !    
 !    Unable to create new local database. Ensure your local Postgres is working and try again.

谷歌搜索一次不会返回结果。我想知道这是否与我做which psql 时没有结果有关。也许我需要对 pgAdmin 做一些特别的事情来让它工作(例如导出命令行工具)?

【问题讨论】:

    标签: postgresql heroku pgadmin


    【解决方案1】:

    您是否在 Mac 上使用Postgres App

    如果是这样,问题可能是createdb 不在您的路径上。尝试通过将以下内容插入~/.bash_profile 来添加它。

    export PATH=$PATH:/Applications/Postgres.app/Contents/Versions/9.4/bin
    

    然后运行source ~/.bash_profile 并重试。

    Postgres 应用网站上有更多信息:http://postgresapp.com/documentation/cli-tools.html

    【讨论】:

    【解决方案2】:

    你的直觉是正确的。您需要能够从命令行访问 Postgres。 pg:pull 正在尝试创建一个新的本地数据库并将相关数据从您的 Heroku 数据库中放入其中。 From the docs:

    此命令将创建一个名为“mylocaldb”的新本地数据库,然后从位于 DATABASE_URL 的数据库中提取数据...

    基本上,您的本地计算机正在尝试在本地运行createdb,但您的终端无法识别它。

    【讨论】:

      【解决方案3】:

      我与这个该死的错误斗争了几个小时。我不能确定这是否适用于所有人,但我发现我的问题源于通过 iTerm/ZSH 而不是普通的 bash 运行命令。我打开了普通的香草终端,运行了命令,一切都按原样启动了。

      【讨论】:

        猜你喜欢
        • 2020-09-26
        • 2016-02-24
        • 2011-12-18
        • 1970-01-01
        • 1970-01-01
        • 2017-01-29
        • 1970-01-01
        • 1970-01-01
        • 2020-01-28
        相关资源
        最近更新 更多