Ruby on rails Ruby on rails新应用程序未创建

Ruby on rails Ruby on rails新应用程序未创建,ruby-on-rails,postgresql,macos-high-sierra,Ruby On Rails,Postgresql,Macos High Sierra,我开始开发新的RoR web应用程序,并面临着奇怪的问题。 我想用Postgresql创建新的应用程序。所以我用brew和MacOS桌面应用程序安装了Postgres。然后键入rails新测试应用程序--database=postgresql At this moment, I can't install bundles because there is certain error. An error occurred while installing pg (1.0.0), and Bun

我开始开发新的RoR web应用程序,并面临着奇怪的问题。 我想用Postgresql创建新的应用程序。所以我用brew和MacOS桌面应用程序安装了Postgres。然后键入
rails新测试应用程序--database=postgresql

At this moment, I can't install bundles because there is certain 
error.

An error occurred while installing pg (1.0.0), and Bundler cannot 
continue.
Make sure that `gem install pg -v '1.0.0' --source 
'https://rubygems.org/'` succeeds before bundling.

In Gemfile:
   pg
          run  bundle exec spring binstub --all
Could not find gem 'pg (< 2.0, >= 0.18)' in any of the gem sources 
listed in your Gemfile.
Run `bundle install` to install missing gems.
目前,我无法安装捆绑包,因为存在某些问题
错误。
安装pg(1.0.0)时出错,Bundler无法启动
继续。
确保'gem install pg-v'1.0.0'--源
'https://rubygems.org/“`捆绑前成功。
在文件中:
pg
运行bundle exec spring binstub--所有
在任何gem源中都找不到gem“pg(<2.0,>=0.18)”
列在您的文件中。
运行“bundle install”安装丢失的gems。
所以我无法启动新的应用程序。 这是因为ruby和postgres版本不匹配而出现的问题吗? 我如何使用postgres创建新的应用程序


我目前正在使用Mac OS high Sierra、postgres 10.5、rails 5.2.1

尝试跳过Bundler:
rails新测试应用程序--database=postgresql--跳过bundle

一旦你生成了你的应用程序,你仍然需要解决为什么
pg
ins没有安装的问题。PG gem应该安装得很好,只要数据库在那里,并且您的系统可以构建gem的本机扩展,所以我的第一个猜测是Postgres没有安装或者在您的环境中找不到


不管怎样,这确实回答了你的问题。跳过这个捆绑包,瞧,Rails将为您生成一个新的干净的应用程序

我发表了一些评论,但我已经看到,通过brew安装postgresql时似乎出现了错误。这并不常见,但有时也会发生

这里有一个快速解决方案:

brew install libpqxx
一定要跑步

brew更新

并通过以下方式重新启动PostgreSQL server:

brew服务重新启动postgresql

还要确保清理brew:

brew清理

如果错误仍然存在,请发布Gemfile和database.yml文件


你好

Postgres已经安装,因此我可以通过Postgres查看其版本--version。在文本编辑器中打开项目,然后发布gemfile+database.yml。还要确保运行:brew服务启动postgresql或brew服务列表,以查看其是否已列出。