Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/59.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails “无法运行”;rails服务器";由于未能安装';pg';珍宝_Ruby On Rails_Ruby_Gem_Pg - Fatal编程技术网

Ruby on rails “无法运行”;rails服务器";由于未能安装';pg';珍宝

Ruby on rails “无法运行”;rails服务器";由于未能安装';pg';珍宝,ruby-on-rails,ruby,gem,pg,Ruby On Rails,Ruby,Gem,Pg,我是RubyonRails新手,我刚刚下载了一个新的rails项目目录,这是我朋友发给我的。我把那个目录放在桌面上,然后把cd放进去。我想在本地主机上玩代码,从代码中学习。但是当我尝试运行“rails s”时,它给了我这样一个错误 "Could not find pg-0.17.1 in any of the sources Run `bundle install` to install missing gems." 所以我运行了“bundle安装”,然后它给出了 "An error occ

我是RubyonRails新手,我刚刚下载了一个新的rails项目目录,这是我朋友发给我的。我把那个目录放在桌面上,然后把cd放进去。我想在本地主机上玩代码,从代码中学习。但是当我尝试运行“rails s”时,它给了我这样一个错误

"Could not find pg-0.17.1 in any of the sources
 Run `bundle install` to install missing gems."
所以我运行了“bundle安装”,然后它给出了

"An error occurred while installing pg (0.17.1), and Bundler cannot continue.
 Make sure that `gem install pg -v '0.17.1'` succeeds before bundling."
我用谷歌搜索了一会儿这个问题,但没有找到任何解决办法。。
“rails s”剧照在我自己的项目目录中运行良好。但是我怎样才能让它在我刚下载的目录中工作呢?我应该做一些其他的设置或安装吗?

确保您已经在本地计算机上安装了postgres


这里是我如何在Mac上创建开发环境的


通过软件包管理器安装PostgreSQL
brew安装PostgreSQL
。这应该为gem编译安装所有必要的头文件。

错误:执行gem时。。。(OptionParser::InvalidoOption)无效选项:---使用pg Config可以指定您正在使用的操作系统吗?例如,在Windows上安装gems是非常棘手的。在linux box上,您需要安装PostgreSQL头文件,以编译gem。