0
我得到了我的Rails 4应用程序运行在我的本地机器上,并在此刻heroku。现在我试图建立一个ubutunu 14服务器。对于部署,我正在使用capistrano,并且已经设置了本地计算机和服务器之间的连接。目前,我试图做最初的部署使用此命令:Postgres的宝石没有加载在初始Rails 4应用程序部署
cap production deploy:initial
我获得以下在某一点错误:
Running ~/.rvm/bin/rvm default do bundle exec rake assets:precompile on MYIP
DEBUG Command: cd /home/deploy/apps/savoir/releases/20160209113448 && (export RAILS_ENV="production" ; ~/.rvm/bin/rvm default do bundle exec rake assets:precompile)
DEBUG rake aborted!
DEBUG Gem::LoadError: Specified 'postgresql' for database adapter, but the gem is not loaded. Add `gem 'pg'` to your Gemfile (and ensure its version is at the minimum required by ActiveRecord).
我的Gemfile看起来是这样的:
source 'http://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.1.8'
# Use sqlite3 as the database for Active Record
# gem 'sqlite3'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0.1'
# 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
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
# Use debugger
# gem 'debugger', group: [:development, :test]
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin]
gem 'bootstrap-sass', '~> 3.3.5.1'
gem 'autoprefixer-rails'
gem 'bootstrap-sass-extras'
gem 'bootstrap-daterangepicker-rails'
gem 'bootstrap-datepicker-rails'
gem 'simple_form'
gem 'nested_form'
gem 'ckeditor'
gem 'coffee-script-source', '1.8.0'
gem 'carrierwave', github:'carrierwaveuploader/carrierwave'
gem 'carrierwave-crop'
gem 'rmagick'
gem 'mini_magick'
gem 'momentjs-rails'
gem 'gon'
gem 'jquery-ui-rails'
gem 'jquery-fileupload-rails'
gem 'jquery-turbolinks'
gem 'jquery-validation-rails'
gem 'devise'
gem 'ransack'
gem 'will_paginate'
gem 'rails_12factor'
gem 'pg', '~> 0.18.3'
gem 'geocoder'
gem 'gmaps4rails'
gem 'underscore-rails'
group :development do
gem 'capistrano', require: false
gem 'capistrano-rvm', require: false
gem 'capistrano-rails', require: false
gem 'capistrano-bundler', require: false
gem 'capistrano3-puma', require: false
end
gem 'puma'
而且我的database.yml:
development:
adapter: postgresql
database: savoir_development
pool: 5
username: postgres
password: root
test:
adapter: postgresql
database: savoir_test
pool: 5
timeout: 5000
username: postgres
password: root
production:
adapter: postgresql
database: deploy
pool: 5
timeout: 5000
username: USER
password: PASSWORD
所以据我所见,gemfile和database.yml应该没问题。任何人都可以找到我犯的错误吗?我发现一些其他线程可以解决这个问题,但他们对我的案例没有帮助。
你已经在gem文件中有sqlite3和pg,我想你需要在gemfile,gem'pg',group :::production中为生产环境添加pg gem,然后对于sqlite 3,gem'sqlite3' ,组::[:development,:test],或者如果你没有使用,就完全删除sqlite3。 –
感谢您的回答。尽管sqlite3 gem被注释掉了。 – Syk
它在gemlock文件中? –