Travis CI can't find 'pg' gem - ruby-on-rails

I'm using Travis CI to test my Rails project.
When it build my commit, it stops on bundle exec rake.
Part of log:
$ gem --version
2.2.2
$ bundle --version
Bundler version 1.6.2
$ bundle install --jobs=3 --retry=3 --deployment
Fetching gem metadata from https://rubygems.org/..........
Fetching additional metadata from https://rubygems.org/..
Installing i18n 0.6.11
Installing rake 10.3.2
Installing minitest 5.4.0
Installing thread_safe 0.3.4
Installing builder 3.2.2
Installing json 1.8.1
Installing erubis 2.7.0
Installing mime-types 1.25.1
Installing rack 1.5.2
Installing polyglot 0.3.5
Installing arel 5.0.1.20140414130214
Installing execjs 2.2.1
Installing coffee-script-source 1.7.1
Installing thor 0.19.1
Installing hike 1.2.3
Using bundler 1.6.2
Installing multi_json 1.10.1
Installing tilt 1.4.1
Installing rails_serve_static_assets 0.0.2
Installing rails_stdout_logging 0.0.3
Installing tzinfo 1.2.1
Installing sass 3.2.19
Installing rack-test 0.6.2
Installing rdoc 4.1.1
Installing treetop 1.4.15
Installing coffee-script 2.3.0
Installing uglifier 2.5.3
Installing sprockets 2.11.0
Installing rails_12factor 0.0.2
Installing sdoc 0.4.0
Installing activesupport 4.1.4
Installing mail 2.5.4
Installing actionview 4.1.4
Installing jbuilder 2.1.3
Installing activemodel 4.1.4
Installing actionpack 4.1.4
Installing activerecord 4.1.4
Installing railties 4.1.4
Installing sprockets-rails 2.1.3
Installing actionmailer 4.1.4
Installing coffee-rails 4.0.1
Installing jquery-rails 3.1.1
Installing sass-rails 4.0.3
Installing turbolinks 2.2.2
Installing rails 4.1.4
Your bundle is complete!
It was installed into ./vendor/bundle
Post-install message from rdoc:
Depending on your version of ruby, you may need to install ruby rdoc/ri data:
<= 1.8.6 : unsupported
= 1.8.7 : gem install rdoc-data; rdoc-data --install
= 1.9.1 : gem install rdoc-data; rdoc-data --install
>= 1.9.2 : nothing to do! Yay!
$ psql -c 'create database travis_ci_test;' -U postgres
CREATE DATABASE
$ cp config/database.yml.travis config/database.yml
$ bundle exec rake
rake aborted!
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).
(As you can see, there is no pg gem installed).
My .travis.yml:
language: ruby
rvm:
- "2.0.0"
addons:
postgresql: "9.3"
before_script:
- psql -c 'create database travis_ci_test;' -U postgres
- cp config/database.yml.travis config/database.yml
My Gemfile:
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.1.4'
# Use postgresql as the database for Active Record
gem 'pg'
# 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
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw]
gem 'rails_12factor', group: :production
ruby "2.0.0"
So 'pg' gem is in the Gemfile and it works on my computer, but Travis doesn't install it.

Is the 'pg' gem in your Gemfile.lock file? If not, you may need to delete this file and regenerate it by running bundle install again.

Removing Gemfile.lock from the repository worked, now build and testing is working as expected.
I guess that happens because of lock-file being created on Windows, and it includes some platform-specific stuff (like mingw32 suffixes for gems)

Related

failed to install pg -v '0.18.4' on mac

I am currently trying to run an application locally but running into some issues with postgreSql.
gem install pg gives me the following:
Fetching gem metadata from http://insecure.rails-assets.org/...
Fetching version metadata from http://insecure.rails-assets.org/..
Fetching gem metadata from http://insecure.rails-assets.org/...
Fetching gem metadata from https://rubygems.org/........
Fetching version metadata from http://insecure.rails-assets.org/..
Fetching version metadata from https://rubygems.org/...
Fetching dependency metadata from http://insecure.rails-assets.org/..
Fetching dependency metadata from https://rubygems.org/..
Resolving dependencies...
Using rake 10.4.2
Using i18n 0.7.0
Using json 1.8.3
Using minitest 5.8.4
Using thread_safe 0.3.5
Using tzinfo 1.2.2
Using activesupport 4.2.5
Using builder 3.2.2
Using erubis 2.7.0
Using mini_portile 0.6.2
Using nokogiri 1.6.6.4
Using rails-deprecated_sanitizer 1.0.3
Using rails-dom-testing 1.0.7
Using loofah 2.0.3
Using rails-html-sanitizer 1.0.2
Using actionview 4.2.5
Using rack 1.6.4
Using rack-test 0.6.3
Using actionpack 4.2.5
Using globalid 0.3.6
Using activejob 4.2.5
Using mime-types 2.6.2
Using mail 2.6.3
Using actionmailer 4.2.5
Using active_link_to 1.0.3
Using activemodel 4.2.5
Using arel 6.0.3
Using activerecord 4.2.5
Using addressable 2.3.8
Using extlib 0.9.16
Using multi_json 1.11.2
Using autoparse 0.3.3
Using coderay 1.1.0
Using better_errors 2.1.1
Using debug_inspector 0.0.2
Using binding_of_caller 0.7.2
Using bootstrap_form 2.3.0
Using bundler 1.8.4
Using byebug 9.1.0 (was 8.2.0)
Using cancancan 1.13.1
Using chartkick 1.4.1
Using chunky_png 1.3.5
Using coffee-script-source 1.10.0
Using execjs 2.6.0
Using coffee-script 2.4.1
Using thor 0.19.1
Using railties 4.2.5
Using coffee-rails 4.1.0
Using concurrent-ruby 1.0.0
Using connection_pool 2.2.0
Using unf_ext 0.0.7.1
Using unf 0.1.4
Using domain_name 0.5.24
Using faker 1.6.1
Using multipart-post 2.0.0
Using faraday 0.9.2
Using ffi 1.9.10
Using font-awesome-rails 4.4.0.0
Using formatador 0.2.5
Using friendly_id 5.0.5
Using jwt 2.2.2
Using little-plugger 1.1.4
Using logging 2.0.0
Using memoist 0.12.0
Using signet 0.6.1
Using googleauth 0.4.2
Using launchy 2.4.3
Using retriable 1.4.1
Using google-api-client 0.8.6
Using groupdate 2.4.0
Using rb-fsevent 0.9.6
Using rb-inotify 0.9.5
Using listen 3.0.5
Using lumberjack 1.0.9
Using nenv 0.2.0
Using shellany 0.0.1
Using notiffany 0.0.8
Using method_source 0.8.2
Using slop 3.6.0
Using pry 0.10.3
Using guard 2.13.0
Using guard-compat 1.2.1
Using guard-minitest 2.4.4
Using tilt 2.0.1
Using haml 4.0.7
Using hashie 3.6.0
Using http-cookie 1.0.2
Using jbuilder 2.3.2
Using jquery-rails 4.0.5
Using mini_magick 4.2.7
Using multi_xml 0.5.5
Using netrc 0.10.3
Using oauth2 1.4.4
Using omniauth 1.9.1
Using omniauth-oauth2 1.7.0
Using omniauth-github 1.1.2
Using omniauth-google-oauth2 0.8.0
Using ruby-openid 2.7.0
Using rack-openid 1.3.1
Using omniauth-openid 1.0.1
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/Users/username/.rbenv/versions/2.2.0/bin/ruby -r ./siteconf20220307-80476-1facihf.rb extconf.rb --with-pg-config=/Applications/Postgres.app/Contents/Versions/9.4/bin/pg_config
Using config values from /Applications/Postgres.app/Contents/Versions/9.4/bin/pg_config
sh: /Applications/Postgres.app/Contents/Versions/9.4/bin/pg_config: No such file or directory
sh: /Applications/Postgres.app/Contents/Versions/9.4/bin/pg_config: No such file or directory
checking for libpq-fe.h... no
Can't find the 'libpq-fe.h header
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/Users/nahomie/.rbenv/versions/2.2.0/bin/$(RUBY_BASE_NAME)
--with-pg
--without-pg
--enable-windows-cross
--disable-windows-cross
--with-pg-config
--with-pg-dir
--without-pg-dir
--with-pg-include
--without-pg-include=${pg-dir}/include
--with-pg-lib
--without-pg-lib=${pg-dir}/lib
extconf failed, exit code 1
Gem files will remain installed in /Users/username/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/pg-0.18.4 for inspection.
Results logged to /Users/username/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/extensions/x86_64-darwin-21/2.2.0-static/pg-0.18.4/gem_make.out
An error occurred while installing pg (0.18.4), and Bundler cannot continue.
Make sure that `gem install pg -v '0.18.4'` succeeds before bundling.
gemfile
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.5'
# Use postgresql as the database for Active Record
gem 'pg'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.1.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
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
# gem 'byebug'
gem 'byebug', '~> 9.1'
# Access an IRB console on exception pages or by using <%= console %> in views
gem 'web-console', '~> 2.0'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
end
# 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]
gem "haml"
gem "omniauth"
gem "omniauth-github"
gem "omniauth-google-oauth2", '~> 0.8.0'
gem "omniauth-openid"
gem "google-api-client"
gem "cancancan"
gem 'bootstrap_form'
gem 'friendly_id', '~> 5.0.0'
gem 'ransack'
gem 'rdiscount', require: 'tilt/rdiscount'
gem 'ruby_identicon'
gem 'sidekiq'
gem "refile", require: "refile/rails"
gem "refile-mini_magick"
gem 'simple_form'
gem 'active_link_to'
gem 'chartkick'
gem 'groupdate'
gem 'faker'
# gem 'skylight'
gem 'bundler', '>= 1.8.4'
source 'http://insecure.rails-assets.org' do
# source 'https://rails-assets.org' do
gem 'rails-assets-bootstrap'
gem 'rails-assets-jasny-bootstrap'
gem 'rails-assets-handlebars'
gem 'rails-assets-datatables'
gem 'rails-assets-datatables-fixedcolumns'
gem 'rails-assets-typeahead.js'
end
gem "font-awesome-rails"
# bring back removed support for respond_with
# gem 'responders', '~> 2.0'
group :production do
gem 'rails_12factor'
gem 'puma'
end
group :development do
gem 'guard'
gem 'guard-minitest'
gem 'better_errors'
gem 'binding_of_caller'
gem 'quiet_assets'
gem 'pry-rails'
end
ruby "2.2.0"
Steps I've tried:
bundle install
gem install pg
gem install pg -v '0.18.4
gem install pg 0.18.4
I also tried to modify the pg in the gemfile with the exact version that was required and then running bundle install
When I tried to run brew install libpq
==> Downloading https://ghcr.io/v2/homebrew/core/libpq/manifests/14.2
Already downloaded: /Users/nahomie/Library/Caches/Homebrew/downloads/84abbc53ffbb8f36dc6dd856d9dcaa4d9b49a9d0f434a334b991f82c22fe63f4--libpq-14.2.bottle_manifest.json
==> Downloading https://ghcr.io/v2/homebrew/core/libpq/blobs/sha256:36b074f07ded99c1945dbcc26f54e45abeba0dbf34d16e63fb6ab16d371158ee
Already downloaded: /Users/nahomie/Library/Caches/Homebrew/downloads/88c1ec435b5360375c672305226528f5ffbfc88c4cb3b1bcf8697e43daa73e21--libpq--14.2.arm64_monterey.bottle.tar.gz
==> Reinstalling libpq
==> Pouring libpq--14.2.arm64_monterey.bottle.tar.gz
==> Caveats
libpq is keg-only, which means it was not symlinked into /opt/homebrew,
because conflicts with postgres formula.
If you need to have libpq first in your PATH, run:
echo 'export PATH="/opt/homebrew/opt/libpq/bin:$PATH"' >> ~/.zshrc
For compilers to find libpq you may need to set:
export LDFLAGS="-L/opt/homebrew/opt/libpq/lib"
export CPPFLAGS="-I/opt/homebrew/opt/libpq/include"
For pkg-config to find libpq you may need to set:
export PKG_CONFIG_PATH="/opt/homebrew/opt/libpq/lib/pkgconfig"
==> Summary
🍺 /opt/homebrew/Cellar/libpq/14.2: 2,336 files, 28.2MB
==> Running `brew cleanup libpq`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
Any help would be appreciated.
You need to install libpq.
STEPS
brew install libpq
Find the libpq version by running below command
brew info libpq
Then install pg with
gem install pg — — with-pg-config=/usr/local/Cellar/libpq/[VERSION FROM ABOVE COMMAND]/bin/pg_config
Hope This solves your Problem.
Thank You

country_select gem causes "Could not find i18n_data-0.10.0 in any of the sources" error

I am trying to use the country_select gem. I installed it using
gem install country_select -v 4.0, then I added it to the bottom of my gemfile, ran bundle install, and then when I tried to restart my server I got this error:
Could not find i18n_data-0.10.0 in any of the sources
Run `bundle install` to install missing gems.
I have searched this error and haven't found anyone else with this problem -- any help here would be really appreciated.
Here is my gemfile:
source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
ruby '2.7.1'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 6.0.3', '>= 6.0.3.3'
# Use postgresql as the database for Active Record
gem 'pg', '>= 0.18', '< 2.0'
# Use Puma as the app server
gem 'puma', '~> 4.1'
# Use SCSS for stylesheets
gem 'sass-rails', '>= 6'
# Transpile app-like JavaScript. Read more: https://github.com/rails/webpacker
gem 'webpacker', '~> 4.0'
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
gem 'turbolinks', '~> 5'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.7'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 4.0'
# Use Active Model has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use Active Storage variant
# gem 'image_processing', '~> 1.2'
# Reduces boot times through caching; required in config/boot.rb
gem 'bootsnap', '>= 1.4.2', require: false
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
end
group :development do
# Access an interactive console on exception pages or by calling 'console' anywhere in the code.
gem 'web-console', '>= 3.3.0'
gem 'listen', '~> 3.2'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0'
end
group :test do
# Adds support for Capybara system testing and selenium driver
gem 'capybara', '>= 2.15'
gem 'selenium-webdriver'
# Easy installation and use of web drivers to run system tests with browsers
gem 'webdrivers'
end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
#country select gemfile
gem 'country_select', '~> 4.0'
bundle install returns the following:
The dependency tzinfo-data (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x86-mswin32, x64-mingw32, java. To add those platforms to the bundle, run `bundle lock --add-platform x86-mingw32 x86-mswin32 x64-mingw32 java`.
Using rake 13.0.1
Using concurrent-ruby 1.1.7
Using i18n 1.8.5
Using minitest 5.14.2
Using thread_safe 0.3.6
Using tzinfo 1.2.7
Using zeitwerk 2.4.0
Using activesupport 6.0.3.3
Using builder 3.2.4
Using erubi 1.9.0
Using mini_portile2 2.4.0
Using nokogiri 1.10.10
Using rails-dom-testing 2.0.3
Using crass 1.0.6
Using loofah 2.7.0
Using rails-html-sanitizer 1.3.0
Using actionview 6.0.3.3
Using rack 2.2.3
Using rack-test 1.1.0
Using actionpack 6.0.3.3
Using nio4r 2.5.3
Using websocket-extensions 0.1.5
Using websocket-driver 0.7.3
Using actioncable 6.0.3.3
Using globalid 0.4.2
Using activejob 6.0.3.3
Using activemodel 6.0.3.3
Using activerecord 6.0.3.3
Using mimemagic 0.3.5
Using marcel 0.3.3
Using activestorage 6.0.3.3
Using mini_mime 1.0.2
Using mail 2.7.1
Using actionmailbox 6.0.3.3
Using actionmailer 6.0.3.3
Using actiontext 6.0.3.3
Using public_suffix 4.0.6
Using addressable 2.7.0
Using bindex 0.8.1
Using msgpack 1.3.3
Using bootsnap 1.4.8
Using bundler 2.1.4
Using byebug 11.1.3
Using regexp_parser 1.7.1
Using xpath 3.2.0
Using capybara 3.33.0
Using childprocess 3.0.0
Using i18n_data 0.10.0
Using sixarm_ruby_unaccent 1.2.0
Using unicode_utils 1.4.0
Using countries 3.0.1
Using sort_alphabetical 1.1.0
Using country_select 4.0.0
Using ffi 1.13.1
Using jbuilder 2.10.1
Using rb-fsevent 0.10.4
Using rb-inotify 0.10.1
Using listen 3.2.1
Using method_source 1.0.0
Using pg 1.2.3
Using puma 4.3.6
Using rack-proxy 0.6.5
Using thor 1.0.1
Using railties 6.0.3.3
Using sprockets 4.0.2
Using sprockets-rails 3.2.2
Using rails 6.0.3.3
Using rubyzip 2.3.0
Using sassc 2.4.0
Using tilt 2.0.10
Using sassc-rails 2.1.2
Using sass-rails 6.0.0
Using selenium-webdriver 3.142.7
Using spring 2.1.1
Using spring-watcher-listen 2.0.1
Using turbolinks-source 5.2.0
Using turbolinks 5.2.1
Using web-console 4.0.4
Using webdrivers 4.4.1
Using webpacker 4.3.0
Bundle complete! 18 Gemfile dependencies, 80 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
With the help of a friend I fixed this. It may have been caused by me downloading a gem via the command line and then adding it to my gemfile which caused a problem with my country_select gem's dependencies.
I tried many things to fix it, and I'm not sure what solved it, so here's what I did:
I deleted my gemfile.lock and ran bundle install and tried rails server again. This caused a different file to not be found. I tried deleting my gemfile.lock and running other commands: bundle update --all, bundle install --redownload, or bundle pristine. Each time, rails server wouldn't start the server because it 'could not find nio4r-2.5.4 in any of the sources'.
Finally, I tried running "bundle exec rails server" and it started the server. However, my "rails test" command was still broken. I think I will need to add "bundle exec" before my rails commands for things to keep working. This may be the only thing that fixed it.

Heroku destroys pg gem during deployment

I am attempting to deploy a Heroku application based on Ruby on Rails, and am having some issues. Although none of these issues existed in past deployments, Heroku randomly deletes the pg gem after deployment. This is my gemfile:
source 'https://rubygems.org'
git_source(:github) do |repo_name|
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
"https://github.com/#{repo_name}.git"
end
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.1.3'
# User rails12 factor for heroku's native ruby support tweaks
gem 'rails_12factor'
# Use wdm for Windows poll changes
gem 'wdm', '>= 0.1.0' if Gem.win_platform?
# Use Puma as the app server
gem 'puma', '~> 3.7'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Bootstrap 3 for themeing and templating
gem 'bootstrap-sass'
# Use bootstrapformfor to allow forms to be auto-formatted as per bootstrap standards
gem 'bootstrap_form'
# Use JQuery code optimized for Bootstrap usage
gem 'jquery-rails'
# Use Dragonfly for image upload and handling
gem 'dragonfly', '~> 1.1.3'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.2'
# Turbolinks makes navigating your web application faster
gem 'turbolinks', '~> 5'
# Build JSON APIs with ease
gem 'jbuilder', '~> 2.5'
# Use Devise for account management and authorization
gem 'devise'
# Use Cancancan for permissions enforcement
gem 'cancancan'
# Use rolify for role assignment to user accounts
gem 'rolify'
# Windows does not include zoneinfo files so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
# Use ActiveModel has_secure_password
gem 'bcrypt', '~> 3.1.7'
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
# Adds support for Capybara system testing and selenium driver
gem 'capybara', '~> 2.13'
gem 'selenium-webdriver'
end
group :development do
# Access an IRB console on exception pages or by using <%= console %> anywhere in the code
gem 'web-console', '>= 3.3.0'
gem 'listen', '>= 3.0.5', '< 3.2'
# Spring speeds up development by keeping your application running in the background
gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0'
# Postgres for active record
gem 'pg'
end
Here is the deployment log:
-----> Ruby app detected
-----> Compiling Ruby/Rails
-----> Using Ruby version: ruby-2.3.4
###### WARNING:
Removing `Gemfile.lock` because it was generated on Windows.
Bundler will do a full resolve so native gems are handled properly.
This may result in unexpected gem versions being used in your app.
In rare occasions Bundler may not be able to resolve your dependencies at all.
https://devcenter.heroku.com/articles/bundler-windows-gemfile
-----> Installing dependencies using bundler 1.15.2
Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4
The dependency tzinfo-data (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x86-mswin32, x64-mingw32, java. To add those platforms to the bundle, run `bundle lock --add-platform x86-mingw32 x86-mswin32 x64-mingw32 java`.
Fetching gem metadata from https://rubygems.org/..........
Fetching version metadata from https://rubygems.org/..
Fetching dependency metadata from https://rubygems.org/.
Resolving dependencies...
Using rake 12.3.0
Using concurrent-ruby 1.0.5
Fetching minitest 5.11.1
Using thread_safe 0.3.6
Using builder 3.2.3
Using erubi 1.7.0
Using mini_portile2 2.3.0
Using crass 1.0.3
Using rack 2.0.3
Fetching nio4r 2.2.0
Using websocket-extensions 0.1.3
Using mini_mime 1.0.0
Using arel 8.0.0
Fetching public_suffix 3.0.1
Installing public_suffix 3.0.1
Installing minitest 5.11.1
Installing nio4r 2.2.0 with native extensions
Using execjs 2.7.0
Using bcrypt 3.1.11
Using rb-fsevent 0.10.2
Using ffi 1.9.18
Using bootstrap_form 2.7.0
Using bundler 1.15.2
Using cancancan 2.1.2
Using coffee-script-source 1.12.2
Using method_source 0.9.0
Using thor 0.20.0
Using orm_adapter 0.5.0
Fetching multi_json 1.13.1
Using puma 3.11.0
Using rails_serve_static_assets 0.0.5
Using rails_stdout_logging 0.0.5
Fetching rolify 5.2.0
Installing multi_json 1.13.1
Installing rolify 5.2.0
Using tilt 2.0.8
Fetching turbolinks-source 5.1.0
Using i18n 0.9.1
Using nokogiri 1.8.1
Installing turbolinks-source 5.1.0
Using tzinfo 1.2.4
Using rack-test 0.8.2
Using warden 1.2.7
Using sprockets 3.7.1
Using websocket-driver 0.6.5
Using mail 2.7.0
Fetching autoprefixer-rails 7.2.4
Fetching uglifier 4.1.3
Installing autoprefixer-rails 7.2.4
Installing uglifier 4.1.3
Using rb-inotify 0.9.10
Using coffee-script 2.4.1
Fetching addressable 2.5.2
Using rails_12factor 0.0.3
Using loofah 2.1.1
Using activesupport 5.1.4
Fetching turbolinks 5.1.0
Installing turbolinks 5.1.0
Installing addressable 2.5.2
Using sass-listen 4.0.0
Using rails-html-sanitizer 1.0.3
Using rails-dom-testing 2.0.3
Using globalid 0.4.1
Using activemodel 5.1.4
Using jbuilder 2.7.0
Fetching dragonfly 1.1.4
Fetching sass 3.5.5
Installing dragonfly 1.1.4
Installing sass 3.5.5
Using activejob 5.1.4
Using actionview 5.1.4
Using activerecord 5.1.4
Using actionpack 5.1.4
Using actionmailer 5.1.4
Using railties 5.1.4
Using sprockets-rails 3.2.1
Using coffee-rails 4.2.2
Using responders 2.4.0
Using jquery-rails 4.3.1
Fetching devise 4.4.0
Installing devise 4.4.0
Using bootstrap-sass 3.3.7
Using sass-rails 5.0.7
Using actioncable 5.1.4
Using rails 5.1.4
Bundle complete! 25 Gemfile dependencies, 72 gems now installed.
Gems in the groups development and test were not installed.
Bundled gems are installed into ./vendor/bundle.
Bundle completed (8.28s)
Cleaning up the bundler cache.
Removing rolify (5.1.0)
Removing turbolinks (5.0.1)
Removing autoprefixer-rails (7.1.6)
Removing sass (3.5.3)
Removing mime-types-data (3.2016.0521)
Removing nio4r (2.1.0)
Removing minitest (5.10.3)
Removing devise (4.3.0)
Removing mimemagic (0.3.2)
Removing cocaine (0.5.8)
Removing pg (0.21.0)
Removing uglifier (3.2.0)
Removing multi_json (1.12.2)
Removing paperclip (5.0.0)
Removing turbolinks-source (5.0.3)
Removing mime-types (3.1)
Removing climate_control (0.2.0)
The latest bundler is 1.16.1, but you are currently running 1.15.2.
To update, run `gem install bundler`
-----> Installing node-v6.11.1-linux-x64
-----> Detecting rake tasks
-----> Preparing app for Rails asset pipeline
Running: rake assets:precompile
rake aborted!
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).
ETCETCETC
Note how it randomly deletes the 'pg' gem after initial bundling. Could someone point me in the right direction?
Set your pg gem to require version 0.2x in your Gemfile:
gem 'pg', '~> 0.20'
What's happening is you're system is incorrectly attempting to use a newer, incompatible version of pg. pg 1.0.0 was released January 10, 2018, but it's not currently supported by rails. Since you aren't specifying which version of pg to use, you're system is trying to use the new version of pg, removing the old version, then failing.
See this rails issue, and this rails issue and this fix (Revert to pg 0.21.0 as Rails does not support pg 1.0.0 yet) for more discussion.
Put your pg gem out of development environment.
Remove gem pg from developement
group :development do
# Access an IRB console on exception pages or by using <%= console %> anywhere in the code
gem 'web-console', '>= 3.3.0'
gem 'listen', '>= 3.0.5', '< 3.2'
# Spring speeds up development by keeping your application running in the background
gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0'
end
and keep it outside from developement
# Postgres for active record
gem 'pg'
Try to the following
Remove gem 'pg' from group :development and keep that on Gemfile outside of group, then run bundler bundle update then follow these steps
git add .
git commit -m "Fixed gem pg issue"
git push heroku master
That will work
If you little bit confused again see the Heroku documentation and start from scratch
Thanks

(Cloud9) The application works fine on the local server but not on heroku

The application works fine on the local server but once it is deployed on heroku , it loses its formatting and also loses its functions. I am including pictures of the local server and heroku.
I am so fraustrated, dont know what to do, even after db:migrate I run the heroku restart. Still no luck!!!
This is my Heroku Log:
-----> Ruby app detected
-----> Compiling Ruby/Rails
-----> Using Ruby version: ruby-2.3.4
-----> Installing dependencies using bundler 1.15.2
Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
Warning: the running version of Bundler (1.15.2) is older than the version that created the lockfile (1.16.0). We suggest you upgrade to the latest version of Bundler by running `gem install bundler`.
Fetching gem metadata from https://rubygems.org/..........
Fetching version metadata from https://rubygems.org/..
Fetching dependency metadata from https://rubygems.org/.
Using rake 12.2.1
Using concurrent-ruby 1.0.5
Using json 1.8.6
Using minitest 5.10.3
Using thread_safe 0.3.6
Using builder 3.2.3
Using erubis 2.7.0
Using mini_portile2 2.3.0
Using crass 1.0.2
Using rack 1.6.8
Using mini_mime 0.1.4
Using arel 6.0.4
Using execjs 2.7.0
Using rb-fsevent 0.10.2
Using ffi 1.9.18
Using bundler 1.15.2
Using coffee-script-source 1.12.2
Using thor 0.20.0
Using multi_json 1.12.2
Using pg 0.21.0
Using rails_serve_static_assets 0.0.5
Using rails_stdout_logging 0.0.5
Using rdoc 4.3.0
Using tilt 2.0.8
Using turbolinks-source 5.0.3
Using i18n 0.9.1
Using tzinfo 1.2.4
Using nokogiri 1.8.1
Using rack-test 0.6.3
Using sprockets 3.7.1
Using mail 2.7.0
Using autoprefixer-rails 7.1.6
Using uglifier 3.2.0
Using coffee-script 2.4.1
Using rb-inotify 0.9.10
Using rails_12factor 0.0.3
Using activesupport 4.2.5
Using sdoc 0.4.2
Using loofah 2.1.1
Using turbolinks 5.0.1
Using sass-listen 4.0.0
Using rails-deprecated_sanitizer 1.0.3
Using globalid 0.4.1
Using activemodel 4.2.5
Using jbuilder 2.7.0
Using rails-html-sanitizer 1.0.3
Using sass 3.5.3
Using rails-dom-testing 1.0.8
Using activerecord 4.2.5
Using activejob 4.2.5
Using actionview 4.2.5
Using bootstrap-sass 3.3.7
Using actionpack 4.2.5
Using actionmailer 4.2.5
Using railties 4.2.5
Using sprockets-rails 3.2.1
Using coffee-rails 4.1.1
Using jquery-rails 4.3.1
Using rails 4.2.5
Using sass-rails 5.0.6
Bundle complete! 15 Gemfile dependencies, 60 gems now installed.
Gems in the groups development and test were not installed.
Bundled gems are installed into ./vendor/bundle.
The latest bundler is 1.16.0, but you are currently running 1.15.2.
To update, run `gem install bundler`
Bundle completed (2.66s)
Cleaning up the bundler cache.
Warning: the running version of Bundler (1.15.2) is older than the version that created the lockfile (1.16.0). We suggest you upgrade to the latest version of Bundler by running `gem install bundler`.
The latest bundler is 1.16.0, but you are currently running 1.15.2.
To update, run `gem install bundler`
-----> Installing node-v6.11.1-linux-x64
Detected manifest file, assuming assets were compiled locally
###### WARNING:
No Procfile detected, using the default web server.
We recommend explicitly declaring how to boot your server process via a Procfile.
https://devcenter.heroku.com/articles/ruby-default-web-server
-----> Discovering process types
Procfile declares types -> (none)
Default types for buildpack -> console, rake, web, worker
-----> Compressing...
Done: 40.9M
-----> Launching...
Released v19
https://xiaolong-blog.herokuapp.com/ deployed to Heroku
This is my Gemfile,.
Gemfile:
source 'https://rubygems.org'
ruby '2.3.4'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.5'
# Use sqlite3 as the database for Active Record
# Use SCSS for stylesheets
gem 'bootstrap-sass', '~> 3.3.7'
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
# See https://github.com/rails/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
group :development, :test do
gem 'sqlite3'
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug'
end
group :development do
# Access an IRB console on exception pages or by using <%= console %> in views
gem 'web-console', '~> 2.0'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
end
group :production do
gem 'pg'
gem 'rails_12factor'
end
Add this near
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"> </script>
</head>
Runon terminal:
RAILS_ENV=production bundle exec rake assets:precompile

'wdm' Gem on Windows 8.1 x64 Ruby 2.1.5

I am trying to learn how to do testing with Rspec, Capybara & Guard. This requires me to install wdm gem as well to work with guard listener on windows.
For some reason its failing.
Can someone tell me what is happening here? This is a bit out of my league. The wdm gem for some reason is not installing:
Gemfile:
source 'https://rubygems.org'
ruby '2.1.5'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.1'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
# See https://github.com/rails/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
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug'
# Testing stuff
gem 'rspec-rails'
gem 'capybara'
gem 'guard-rspec'
gem 'wdm'
# Access an IRB console on exception pages or by using <%= console %> in views
gem 'web-console', '~> 2.0'
end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
what happens when I bundle install:
$ bundle install
DL is deprecated, please use Fiddle
Fetching gem metadata from https://rubygems.org/.........
Fetching version metadata from https://rubygems.org/..
Resolving dependencies.....
Using rake 10.4.2
Using i18n 0.7.0
Using json 1.8.2
Using minitest 5.6.0
Using thread_safe 0.3.5
Using tzinfo 1.2.2
Using activesupport 4.2.1
Using builder 3.2.2
Using erubis 2.7.0
Using mini_portile 0.6.2
Using nokogiri 1.6.6.2
Using rails-deprecated_sanitizer 1.0.3
Using rails-dom-testing 1.0.6
Using loofah 2.0.1
Using rails-html-sanitizer 1.0.2
Using actionview 4.2.1
Using rack 1.6.0
Using rack-test 0.6.3
Using actionpack 4.2.1
Using globalid 0.3.5
Using activejob 4.2.1
Using mime-types 2.5
Using mail 2.6.3
Using actionmailer 4.2.1
Using activemodel 4.2.1
Using arel 6.0.0
Using activerecord 4.2.1
Using debug_inspector 0.0.2
Using binding_of_caller 0.7.2
Using bundler 1.9.4
Using columnize 0.9.0
Using byebug 4.0.5
Using xpath 2.0.0
Using capybara 2.4.4
Using hitimes 1.2.2
Using timers 4.0.1
Using celluloid 0.16.0
Using coderay 1.1.0
Using coffee-script-source 1.9.1.1
Using execjs 2.5.2
Using coffee-script 2.4.1
Using thor 0.19.1
Using railties 4.2.1
Using coffee-rails 4.1.0
Using diff-lcs 1.2.5
Using ffi 1.9.8
Using formatador 0.2.5
Using rb-fsevent 0.9.4
Using rb-inotify 0.9.5
Using listen 2.10.0
Using lumberjack 1.0.9
Using nenv 0.2.0
Using shellany 0.0.1
Using notiffany 0.0.6
Using method_source 0.8.2
Using slop 3.6.0
Using win32console 1.3.2
Using pry 0.10.1
Using guard 2.12.5
Using guard-compat 1.2.1
Using rspec-support 3.2.2
Using rspec-core 3.2.3
Using rspec-expectations 3.2.1
Using rspec-mocks 3.2.1
Using rspec 3.2.0
Using guard-rspec 4.5.0
Using multi_json 1.11.0
Using jbuilder 2.2.13
Using jquery-rails 4.0.3
Using sprockets 3.0.2
Using sprockets-rails 2.2.4
Using rails 4.2.1
Using rdoc 4.2.0
Using rspec-rails 3.2.1
Using sass 3.4.13
Using tilt 1.4.1
Using sass-rails 5.0.3
Using sdoc 0.4.1
Using sqlite3 1.3.10
Using turbolinks 2.5.3
Using tzinfo-data 1.2015.4
Using uglifier 2.7.1
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
c:/RailsInstaller/Ruby2.1.0/bin/ruby.exe -r ./siteconf20150425-10244-tjzt35.rb extconf.rb
extconf failed, uncaught signal 11
Gem files will remain installed in c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/wdm-0.1.0 for inspection.
Results logged to c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/extensions/x86-mingw32/2.1.0/wdm-0.1.0/gem_make.out
An error occurred while installing wdm (0.1.0), and Bundler cannot continue.
Make sure that `gem install wdm -v '0.1.0'` succeeds before bundling.
Make sure you have installed Devkit,if you did not,downloads DevKit, Then Click Extract and wait until the process is finished.Next, you need to initialize the DevKit and bind it to your Ruby installation. Open your favorite command line tool and navigate to the folder you extracted the DevKit into.Auto-detect Ruby installations and add them to a configuration file for the next step.
ruby dk.rb init
Install the DevKit, binding it to your Ruby installation.
ruby dk.rb install
run
gem install wdm -v '0.1.0'
bundle install
bundle update
If you get error just check which gem needs to be installed and install it.But I would recommend RailsInstaller.
Note: RailsInstaller is the best package for installing rails on windows.I have tried it on windows8 works great.It includes all required Packages. RilasInstaller - http://railsinstaller.org/en

Resources