LoginSignup
2
0

More than 5 years have passed since last update.

herokuにデプロイする上で躓いた事①(sqlite以外をbundleする時)

Posted at

#問題点h1
herokuにはsqliteは使えず、pgを使うとの事だが上手くいかない。

#解決策h2
gemfile内に
group :production do
gem 'pg', '~> 0.20'
gem 'rails_12factor'
end

group :development, :test do
gem 'sqlite3', '1.3.13'
end

group :development, :test do
gem 'byebug', '9.0.6', platform: :mri
end

group :development do
gem 'web-console', '3.5.1'
gem 'listen', '3.0.8'
gem 'spring', '2.0.2'
gem 'spring-watcher-listen', '2.0.1'
end

productiongropとdevelopmentgroupを作り下記を実行。

Bundle complete! 25 Gemfile dependencies, 82 gems now installed.
Gems in the groups production and development were not installed.
Use bundle info [gemname] to see where a bundled gem is installed.





bundle install --without production 
Bundle ! 25 Gemfile dependencies, 91 gems now installed.
Gems in the group production were not installed.
Use bundle info [gemname] to see where a bundled gem is installed.

$ git push heroku master
remote: -----> Installing dependencies using bundler 1.15.2
remote: Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
remote: Warning: the running version of Bundler (1.15.2) is older than the version that created the lockfile (1.16.1). We suggest you upgrade to the latest version of Bundler by running gem install bundler.

remote: Bundle complete! 25 Gemfile dependencies, 84 gems now installed.
remote: Gems in the groups development and test were not installed.
remote: Bundled gems are installed into ./vendor/bundle.
remote: Post-install message from paperclip:
remote: ##################################################
remote: # NOTE FOR UPGRADING FROM 4.3.0 OR EARLIER #
remote: ##################################################
remote: Paperclip is now compatible with aws-sdk >= 2.0.0.
remote: If you are using S3 storage, aws-sdk >= 2.0.0 requires you to make a few small
remote: changes:
remote: * You must set the s3_region
remote: * If you are explicitly setting permissions anywhere, such as in an initializer,
remote: note that the format of the permissions changed from using an underscore to
remote: using a hyphen. For example, :public_read needs to be changed to
remote: public-read.
remote: For a walkthrough of upgrading from 4 to 5 and aws-sdk >= 2.0 you can watch
remote: http://rubythursday.com/episodes/ruby-snack-27-upgrade-paperclip-and-aws-sdk-in-prep-for-rails-5
remote: Bundle completed (29.23s)
remote: Cleaning up the bundler cache.
remote: -----> Installing node-v6.11.1-linux-x64
remote: -----> Detecting rake tasks
remote: -----> Preparing app for Rails asset pipeline
remote: Running: rake assets:precompile
remote: rake aborted!
remote: 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内の gem "pg" を gem 'pg', '~> 0.20'
に変えることによってエラー取れた。
git push heroku master 完了。

参考:https://stackoverflow.com/questions/39261996/heroku-and-rails-gem-load-error-with-postgres-however-it-is-specified-in-gemfi

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0