简体   繁体   English

无法安装gem pg

[英]Can't install gem pg

I just started learning Ruby on Rails with my mac and I'm stuck. 我刚开始使用Mac学习Ruby on Rails,但遇到了麻烦。 I'm using PostgreSQL as my database, and of course, the gem 'pg'. 我正在使用PostgreSQL作为数据库,当然还有gem'pg'。

When I bundle install or I try to create a controller it gives me lots of syntax errors. 当我bundle install或尝试创建控制器时,它给了我很多语法错误。 However, if I delete that gem from my gemfile, I get no syntax errors. 但是,如果我从gemfile中删除该gem,则不会出现语法错误。

I used to have that gem as gem 'pg' with fancy quotes and it gave me an error related only to that line. 我曾经以gem 'pg'加上花哨的引号,这给了我一个仅与该行有关的错误。 Something like 就像是

can't find gem pg 找不到宝石pg

I've been searching questions related here, but none of them showed me an answer, even though I tried everything I saw. 我一直在搜索与此处相关的问题,但是即使我尝试了所有看到的问题,也没有一个给我答案。 I also asked a guy who works with RoR and he told me to change the quotes' shape (from fancy to normal), which lead to the error I have shown you. 我还问了一个与RoR合作的人,他告诉我更改引号的形状(从花哨改为正常),这会导致我向您显示错误。

首先,您应该为pg gem安装本机扩展:请考虑以下主题在OS X上安装PG gem-无法构建本机扩展然后,您应该能够使用gem install pg安装该gem。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM