[英]Ruby Gemfile can not add the PostgreSQL gem
Here's my Gemfile: 这是我的Gemfile:
source 'https://rubygems.org'
#my added gems
gem 'pg', '~> 0.17.1'
gem 'rails_12factor', '0.0.2'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.1.0'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.3'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring', group: :development
You can see on the 4th line that I add the line for the pg
gem. 您可以在第四行看到为
pg
gem添加的行。 After saving and running bundle install
in my terminal I get the following error with this error: 在终端中保存并运行
bundle install
,出现以下错误,并显示以下错误:
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.
Anyone know how to get around this? 有人知道如何解决这个问题吗?
Did you try before bundle install what the message says? 捆绑安装之前,您是否尝试过该提示信息?
gem install pg -v '0.17.1'
Also, If you are running this locally and you need postrgre just to deploy the app to a server like Heroku(you are using sqlite/mysql locally) add it to the production enviroment like this: 另外,如果您在本地运行此程序,并且需要postrgre只是将应用程序部署到类似Heroku的服务器(您在本地使用sqlite / mysql),则将其添加到生产环境中,如下所示:
group :production do
gem 'pg'
end
and run 并运行
bundle install
again. 再次。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.