UPDATED: Per Michael's suggestion/comment, I am reformatting below display code. I also made the minor fixes on code like rails which was commented out and also not latest. The history of the Gemfile dates back to Michael Hartl's RoR tutorial - I had made an app using it but not touched in last 2 years.
Now I have run bundle update which resulted in a lot of things getting updated which was nice. However at the end it gave me the same error as before - see below pls. Any further advice would be great pls. Thank you.
Installing puma 3.12.6 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
....
An error occurred while installing puma (3.12.6), and Bundler cannot continue.
Make sure that `gem install puma -v '3.12.6' --source 'https://rubygems.org/'` succeeds before bundling.
Pls see below my Gemfile.
source 'https://rubygems.org'
ruby "2.6.3"
gem 'rails', '5.0.7.2'
gem 'will_paginate', '3.1.0'
gem 'bootstrap-will_paginate', '0.0.10'
gem 'faker', '1.6.3'
gem 'carrierwave', '0.11.2'
gem 'mini_magick', '4.5.1'
gem 'fog', '1.38.0'
gem 'bcrypt', '3.1.11'
gem 'bootstrap-sass', '3.3.6'
gem 'puma', '~> 3.4'
gem 'sass-rails', '5.0.5'
gem 'uglifier', '3.0.0'
gem 'coffee-rails', '4.2.1'
gem 'jquery-rails', '>= 4.3.3'
gem 'turbolinks', '5.0.0'
gem 'jbuilder', '2.4.1'
gem 'figaro', '1.1.1'
gem 'haml'
gem 'country_select'
gem 'city-state'
gem 'redis'
gem 'devise', '>= 4.2.0'
gem 'friendly_id', '~> 5.1.0'
gem 'geoip'
gem 'bootstrap-datepicker-rails'
gem 'social-share-button'
gem 'trix'
gem 'activeadmin', '~> 1.1.0.pre3'
gem 'arctic_admin'
gem 'stripe'
gem 'money'
gem 'eu_central_bank'
gem 'newrelic_rpm'
gem 'cloudinary'
group :development, :test do
gem 'pg', '0.20.0'
gem 'byebug', '9.0.0', platform: :mri
end
group :development do
gem 'web-console', '3.1.1'
gem 'listen', '3.0.8'
gem 'spring', '1.7.2'
gem 'spring-watcher-listen', '2.0.0'
end
group :test do
gem 'rails-controller-testing', '0.1.1'
gem 'minitest-reporters', '1.1.9'
gem 'guard', '2.13.0'
gem 'guard-minitest', '2.4.4'
end
group :production do
gem 'pg', '0.20.0'
end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
Based on the Gemfile (note correct spelling—not GemFile), it appears that the version of Puma is wrong. If you’re using a Gemfile.lock with a different version, that could account for the error. Also, your rails gem appears to be commented out, which is unlikely to be right.
One step you’re likely to need is this:
bundle update
That being said, the version mismatch indicates that there may be deeper issues. Where did this Gemfile come from? Why is rails commented out? Etc. These are the sort of things that would help people answer your question.
Solved with the help of Michael Hartl on twitter.
Had to remove Gemfile.lock and hardcode puma version to gem 'puma', '~> 4.1' and then run bundle install.
If my website ever gets its 15mins of fame, I will be talking about Michael for the first 5 mins at least.
Related
Error when pushing to Heroku Could not find activerecord-postgis-adapter-5.0.0 in any of the sources.
Using PostGIS in development and production.
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
ruby '2.4.0'
gem 'bundler'
gem 'rails', '~> 5.1.2'
gem 'pg'
gem 'puma', '3.4'
gem 'uglifier', '>= 3.2.0'
gem 'bootstrap', '~> 4.0.0.beta'
gem 'turbolinks', '~> 5'
gem 'jbuilder', '~> 2.5'
gem 'bcrypt', '~> 3.1.11'
gem 'carrierwave', '1.1.0'
gem 'leaflet-rails'
gem 'activerecord-postgis-adapter'
gem 'rgeo-geojson'
gem 'leaflet-draw-rails'
gem 'jquery-rails'
gem 'tether-rails'
gem 'jquery-ui-rails'
gem 'will_paginate', '3.1.5'
gem 'bootstrap-will_paginate', '1.0.0'
gem 'gon'
gem 'aws-sdk', '~> 2.3'
group :development do
gem 'web-console', '>= 3.5.1'
gem 'listen', '>= 3.0.8', '< 3.2'
gem 'database_cleaner'
gem 'rubocop', require: false
gem 'dotenv-rails'
gem 'awesome_print'
gem 'super_awesome_print'
gem 'heroku_db_restore'
end
group :development, :test do
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
gem 'pry-byebug'
gem "better_errors"
gem 'binding_of_caller'
gem 'capybara', '~> 2.13'
gem 'selenium-webdriver'
end
group :test do
gem 'minitest-reporters', '1.1.9'
gem 'guard', '2.14.1'
gem 'guard-minitest', '2.4.6'
gem 'rails-controller-testing', '1.0.2'
gem 'simplecov', :require => false
end
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
database.yml (edited):
default: &default
adapter: postgis
encoding: unicode
pool: 5
Thank you for any suggestions. Is the activerecord-postgis-adapter asking for something not needed. https://github.com/rgeo/activerecord-postgis-adapter.
Problem with stackoverflow. Usually get asked to put in more code. Now can't post because not enough details. Not sure what I should add, so I'll keep typing until the error goes away. I have been able to push this to Heroku in the past, but have have other issues with the postgis-adaptor and maybe it's a recent update that's causing the problem. I don't know where the version number is coming from. The sources part of the Gemfile is a bit of a mystery to me.
Among other things I tried:
gem uninstall activerecord-postgis-adapter
Select gem to uninstall:
1. activerecord-postgis-adapter-3.1.2
2. activerecord-postgis-adapter-4.0.2
3. activerecord-postgis-adapter-5.0.0
4. activerecord-postgis-adapter-5.0.1
5. All versions
I selected option 5 and reran bundle install. Gemfile.lock now activerecord-postgis-adapter (4.0.4) but on Heroku push still get Could not find activerecord-postgis-adapter-5.0.0 in any of the sources.
Check your Gemfile.lock for that Gem, I am guessing you installed it previously (possibly on another system if its checked it) and locked to 5.0.0?
RubyGems does not have a 5.0.0 version of this Gem, so it would seem the author deleted it. https://rubygems.org/gems/activerecord-postgis-adapter
Bundler however will never update your gems automatically (it tracks the version in Gemfile.lock), but you can use bundle update or bundle update activerecord-postgis-adapter to tell it to do so.
See http://bundler.io/man/bundle-update.1.html
I made two changes and am not sure which was the key. I changed gem 'pg', '~>0.18.4' by removing the version constraint which then lead to v 0.21.0 being installed. I also moved gem 'rgeo-geojson' to above gem 'activerecord-postgis-adapter' in the Gemfile. Ended up with activerecord-postgis-adapter 4.0.4 after bundle update, which isn't the latest version so still curious how all this works. I suspect the former change is the one that's important. I based these changes on a newer related app that I am working on that did upload to Heroku.
I'm getting a strange error message when running bundle install or even just rails -v within a rails project root directory:
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/dependency.rb:296:in `to_specs': Could not find 'railties' (>= 0) among 16 total gem(s) (Gem::LoadError)
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/dependency.rb:307:in `to_spec'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_gem.rb:47:in `gem'
from /usr/local/bin/rails:22:in `<main>'
However this doesn't happen in my home directory /Users/myname
I messed up something and don't know what, any help?
EDIT
Gemfile
source 'https://rubygems.org'
ruby '2.2.0'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.0'
gem 'checkr-official'
gem 'chronic'
gem 'devise', '~> 3.4.0'
gem 'exception_notification'
gem 'friendly_id'
gem 'geocoder'
gem 'kaminari'
gem "mini_magick"
gem 'mysql2'
gem 'linkedin'
gem 'omniauth'
gem 'omniauth-facebook'
gem "omniauth-google-oauth2"
gem 'RedCloth'
gem "refile", require: "refile/rails"
gem "refile-mini_magick"
gem 'StreetAddress'
gem "stripe"
gem 'truevault', github: "marks/truevault.rb", ref: "e3bda1af6bfb355"
gem 'whenever', '~> 0.9.4'
gem 'impressionist'
gem "koala"
gem 'twilio-ruby', '~> 4.11.1'
# CSS and javascript
gem 'coffee-rails', '~> 4.1.0'
gem 'compass-rails'
gem 'ejs'
gem 'faker'
gem 'font-awesome-sass', '~> 4.3.0'
gem 'jquery-rails'
gem 'jquery-ui-rails'
gem 'momentjs-rails', '>= 2.8.1'
gem 'sass-rails'
gem 'uglifier', '>= 1.3.0'
# Generic admin requirements not specified elsewhere
gem 'bootstrap-sass', '>= 3.3' # 3.3 adds better support for media css object
gem 'simple_form', ">= 3.1.0.rc2"
# google api client used for dashboard authorization for google analytics
gem 'google-api-client'
gem 'capistrano', '~> 3.4'
gem 'capistrano-rvm'
gem 'capistrano-rails'
gem "capistrano-db-tasks", require: false
group :development do
gem 'awesome_print', :require => 'ap'
end
group :development, :test do
gem "factory_girl_rails", "~> 4.0"
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug'
gem 'pry'
# 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', '1.4.0'
end
This error is probably caused by a corruption of the Rails installation.
Try running gem list. If you don't see railties in the list, run gem install rails.
If that doesn't work, I think you should try starting afresh. Create a new gemset, install bundler and run bundle install. That should fix things.
This is my gem gem file as you can see I use outdated version of rails and may be ruby and may be something else. This happened because I Followed Michel's Hart tutorial and took this gems from there.
source 'https://rubygems.org'
ruby '2.0.0'
#ruby-gemset=railstutorial_rails_4_0
gem 'rails', '4.0.2'
gem 'bootstrap-sass', '2.3.2.0'
gem 'sprockets', '2.11.0'
gem 'bcrypt-ruby', '3.1.2'
gem 'faker', '1.1.2'
gem 'will_paginate', '3.0.4'
gem 'bootstrap-will_paginate', '0.0.9'
gem 'ffaker'
gem 'carrierwave', '~> 0.9'
gem "font-awesome-rails"
gem 'sprockets-rails'
gem 'rest-client'
gem 'blogo'
group :development, :test do
gem 'sqlite3', '1.3.8'
gem 'rspec-rails', '2.13.1'
end
group :test do
gem 'selenium-webdriver', '2.35.1'
gem 'capybara', '2.1.0'
gem 'factory_girl_rails', '4.2.1'
end
gem 'sass-rails', '4.0.1'
gem 'uglifier', '2.1.1'
gem 'coffee-rails', '4.0.1'
gem 'jquery-rails', '3.0.4'
gem 'turbolinks', '1.1.1'
gem 'jbuilder', '1.0.2'
group :doc do
gem 'sdoc', '0.3.20', require: false
end
group :production do
gem 'pg', '0.15.1'
gem 'rails_12factor', '0.0.2'
gem 'heroku-deflater'
end
Hello,
On Feb 24, 2016, Ruby 2.0.0 security maintenance will reach its
end-of-life. When this happens, Ruby 2.0.0 will no longer receive
security updates. We recommend that you upgrade your app to a
supported Ruby version, e.g. 2.2.4, to ensure that your application is
running in a secure environment.
So which version of the ruby and rails do you suggest to put into my gemfile?
I would put the most current stable rails and ruby versions.
at this point that would be ruby '2.3' and rails '4.2'
At the time of writing most current ruby supported on heroku is 2.3.0.
To run rails on 2.3 without warnings about some cyclic dependencies you need rails 4.2+, but note that some things changed from 4.0 to 4.2 and you may have to do a migration, see guide on that
I'm using ruby 2.2.4. I get this error when I tried to sign up after installing the Devise gem. I never experienced this error when I used to use ruby 2.1.5. Is the ruby version the cause of the error here?
UPDATE: this is what my gemfile looks like and I'm using Windows 7 Professional 64-bit
source 'https://rubygems.org'
gem 'rails', '4.2.5.1'
gem 'sqlite3'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.1.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'simple_form', '~> 3.2', '>= 3.2.1'
gem 'country_select', '~> 2.5', '>= 2.5.1'
gem 'devise', '~> 3.5', '>= 3.5.6'
group :doc do
gem 'sdoc', '~> 0.4.0'
end
group :development, :test do
# 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'
end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
Devise 3.5.6 needs bcrypt <= 3.0, which you probably have, but some versions of bcrypt were not supported with specific versions of Ruby on Windows, which is probably what you're seeing.
This is what I dug up on the bcrypt github repo:
1) Launch a terminal session
2) Enter gem uninstall bcrypt
3) Enter gem uninstall bcrypt-ruby
4) Enter gem install bcrypt --platform=ruby
5) Edit your gemfile to include the following line:
gem 'bcrypt-ruby', '3.1.5', :require => 'bcrypt'
6) Run bundle install
Everytime I run a heroku command I receive this error:
Your Ruby version is 1.9.3, but your Gemfile specified 2.1.2
This has been happening since I pushed several changes (adding sidekiq and making changes to my clock.rb file, also: a new model I need to migrate the db for)
Does anyone know why this might be happening? It only started after I added ruby '2.1.2' to the gemfile. But before that I was getting this funky segmentation fault error.
Here's my gemfile:
source 'https://rubygems.org'
ruby '2.1.2'
gem 'rails', '4.1.1'
gem 'pg'
gem 'sass-rails', '~> 4.0.3'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'jquery-rails'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc
gem 'clockwork'
gem 'httparty'
gem 'omniauth-facebook'
gem 'parse-ruby-client'
gem 'parse_resource', '~> 1.8.0'
gem 'stripe', :git => 'https://github.com/stripe/stripe-ruby'
gem 'sidekiq'
gem 'foundation-rails'
group :development, :test do
gem 'pry-rails'
gem 'rspec-rails'
gem 'factory_girl_rails'
gem 'shoulda-matchers'
gem 'valid_attribute'
gem 'capybara'
gem 'dotenv-rails'
gem 'better_errors'
gem 'binding_of_caller'
end
group :production do
gem 'rails_12factor'
gem 'thin'
end
It's seems to related bundler issue. Go through here https://github.com/sstephenson/rbenv/issues/400 same sort of issue also here get fixed with :
# Rakefile
task :freedom do
Bundler.with_clean_env { sh "heroku" }
end
Hope this help you!
I had two applications using Ruby. In your terminal, change to the directory of the application, then check the Ruby version you are using. Update it appropriately.