Heroku pg:pull is giving sh: createdb: command not found

和自甴很熟 提交于 2019-12-21 18:29:43

问题


When I try to do heroku pg:pull DATABASE_URL myappspassword, I get this error:

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.

For once Googling doesn't return a result. I'm wondering if it's related to the fact that when I do which psql, there is no result. Maybe I need to do something special with pgAdmin to get this working (e.g. export command line tools)?


回答1:


Are you on a Mac, by chance, and using Postgres App?

If so, the problem might be that createdb isn't on your path. Try adding it by inserting the following into ~/.bash_profile.

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

Then run source ~/.bash_profile and try again.

There's more info on the Postgres App site: http://postgresapp.com/documentation/cli-tools.html




回答2:


Your instincts are correct. You need to be able to access the Postgres from your command line. pg:pull is attempting to create a new local database and drop the relevant data from your Heroku database into it. From the docs:

This command will create a new local database named “mylocaldb” and then pull data from database at DATABASE_URL...

Basically, your local machine is trying to run createdb locally but your terminal isn't recognizing it.




回答3:


I battled this damn error for a few hours. I can't say for certain if this will work for everyone but I found my issue stemmed from running the command via iTerm/ZSH instead of just normal bash. I opened up plain-old vanilla terminal, ran the command, and everything fired off like it should.



来源:https://stackoverflow.com/questions/24315005/heroku-pgpull-is-giving-sh-createdb-command-not-found

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!