I was working on a GoRails refile gem course and trying to implement it into my app. When I tried to do bundle install, I kept running into an error message in my console saying that bundle could not find compatible versions for my gem "rack" (screenshot of error below).
I tried looking at these Stackoverflow questions - Bundler could not find compatible versions for gem "rack": In Gemfile: and Bundler could not find compatible versions for gem "rack": without success. I tried multiple approaches - 1. putting rack in my Gemfile, 2. uninstalling all previous rack and then installing rack versions. None seemed to work. I would greatly appreciate any help on this issue. Thank you so much.
Gemfile
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.1', '>= 5.1.3'
gem 'sqlite3'
gem 'puma', '~> 3.0'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.2'
gem 'jquery-rails'
gem 'jquery-ui-sass-rails', '~> 4.0', '>= 4.0.3.0'
gem 'turbolinks', '~> 5'
gem 'jbuilder', '~> 2.5'
gem 'bootstrap-sass', '~> 3.3', '>= 3.3.7'
gem 'devise', '~> 4.3'
gem 'omniauth-facebook'
gem 'paperclip', '~> 5.1'
gem 'redis'
gem "font-awesome-rails"
gem "twemoji"
gem 'koala', '~> 2.5'
gem 'chosen-rails'
gem 'devise-bootstrap-views', '~> 0.0.9'
gem 'pry', '~> 0.10.4'
gem 'bootstrap-modal-rails', '~> 2.2', '>= 2.2.5'
gem 'better_errors', '~> 2.3'
gem 'selectize-rails', '~> 0.12.4'
gem 'ransack', '~> 1.8', '>= 1.8.2'
gem 'searchkick', '~> 2.3', '>= 2.3.1'
gem 'jquery-fileupload-rails', '~> 0.4.7'
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug', platform: :mri
end
group :development do
# Access an IRB console on exception pages or by using <%= console %> anywhere in the code.
gem 'web-console'
gem 'listen', '~> 3.0.5'
# 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
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
Related
I have a project I'm trying to use ruby 3 (previously running with 2.7.2), but couldn't accomplish it.
After updated my gemfile with the ruby version and ran bundle, I'm receiving this error when trying to access rails c:
/home/rwehresmann/.rvm/gems/ruby-3.0.0/gems/bootsnap-1.5.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require': cannot load such file -- webrick/httputils (LoadError)
I already tried to add webrick gem to see what happens, and the result is that rails c get stuck.
Here is my gemfile:
source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
ruby '3.0.0'
gem 'rails', '~> 6.0.1'
gem 'pg', '>= 0.18', '< 2.0'
gem 'puma', ">= 4.3.3"
gem 'aws-sdk-s3', '~> 1'
gem 'http', '~> 4.3.0'
gem 'redis', '~> 4.1.3'
gem 'jwt', '~> 2.2.1'
gem 'pundit', '~> 2.1.0'
gem 'blueprinter', '~> 0.23.0'
gem 'money-rails', '~> 1.13.3'
gem 'dry-struct', '~> 1.3.0'
gem 'sidekiq', '~> 6.0.5'
gem 'sidekiq-scheduler', '~> 3.0.1'
gem 'friendly_id', '~> 5.2.4'
gem 'holidays', '~> 8.4.1'
gem 'administrate', '~> 0.14.0'
gem 'administrate-field-enum', '~> 0.0.9'
gem 'pg_search', '~> 2.3.2'
gem 'ransack', '~> 2.3.2'
gem 'administrate-field-active_storage', '0.3.4'
gem 'image_processing', '~> 1.2'
gem 'rolify', '~> 5.3.0'
gem 'active_storage_validations', '~> 0.8.7'
gem 'audited', '~> 4.9'
gem 'slack-ruby-client', '~> 0.15.0'
gem 'inky-rb', require: 'inky'
# Stylesheet inlining for email
gem 'premailer-rails'
# Reduces boot times through caching; required in config/boot.rb
gem 'bootsnap', '>= 1.4.2', require: false
# Use Rack CORS for handling Cross-Origin Resource Sharing (CORS), making cross-origin AJAX possible
gem 'rack-cors'
group :development, :test do
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
gem 'rspec-rails', '~> 3.8.3'
gem 'factory_bot_rails', '~> 5.1.1'
gem 'capybara', '~> 3.31.0'
end
group :development do
gem 'listen', '~> 3.4'
# 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'
gem 'letter_opener'
end
group :test do
gem 'shoulda-matchers', '~> 4.2.0'
gem 'webmock', '~> 3.8.2'
end
Any suggestions?
You have spring in your gemfile, usually hanging consoles and servers are related to that. The webrick gem was removed from the standard library in Ruby 3, so that's why it needs to be included in your Gemfile.
Add webrick to your Gemfile, do a bundle install, and then stop the background spring server with bin/spring stop. Then re-run the server.
Your best bet on solving issues with spring would be to head over and read about the gem on the GitHub project page, or opening a new question here on SO.
Try:
bundle add webrick
Adding gem "webrick" to Gemfile solves the problem.
I'm using Elastic Beanstalk to deploy ruby on rails application to aws. im following the instruction on this website.
Deploying a Rails Application to Elastic Beanstalk
but WHEN i get to step to deploy the application i get an error
This image from eb-activity.log
gem 'jquery-rails'
gem 'rails', '~> 5.1.4'
gem 'sqlite3'
gem 'puma', '~> 3.7'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'therubyracer', platforms: :ruby
gem 'coffee-rails', '~> 4.2'
gem 'turbolinks', '~> 5'
gem 'jbuilder', '~> 2.5'
gem 'redis', '~> 3.0'
gem 'bcrypt', '~> 3.1.7'
gem 'capistrano-rails', group: :development
group :development, :test do
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
gem 'capybara', '~> 2.13'
gem 'selenium-webdriver'
end
group :development do
gem 'web-console', '>= 3.3.0'
gem 'listen', '>= 3.0.5', '< 3.2'
gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0'
end
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
gem 'bootstrap-sass', '~> 3.3.7'
gem 'devise', '~>4.2'
gem 'toastr-rails', '~> 1.0'
gem 'omniauth', '~> 1.6'
gem 'omniauth-facebook', '~> 4.0'
gem 'paperclip', '~>5.1.0'
gem 'aws-sdk','~> 2.8'
gem 'geocoder', '~> 1.4'
gem 'jquery-ui-rails', '~> 5.0'
gem 'ransack', '~> 1.7'
gem 'twilio-ruby', '~> 4.11.1'
gem 'fullcalendar-rails', '~> 3.4.0'
gem 'momentjs-rails', '~> 2.17.1'
gem 'stripe', '~> 3.0.0'
gem 'rails-assets-card', source: 'https://rails-assets.org'
gem 'omniauth-stripe-connect', '~> 2.10.0'
gem 'chartkick', '~> 2.2.4'
gem 'mysql2', '~> 0.3.18'
gem 'yaml_db'
gem 'vider'
gem 'nokogiri', '1.8.1'
The relevant error is:
Installing nokogiri 1.8.1 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
nokogiri 1.8.1 has security vulnerabilities so it is a very good idea to upgrade to the latest version, which is 1.8.3. This also might have the side effect of fixing the build error you are seeing, so it is worth a shot.
On your development machine, upgrade nokogiri like this:
bundle update --conservative nokogiri
Then commit the Gemfile.lock, push and redeploy.
If that still doesn't work, you may simply not have enough memory on the server to compile the nokogiri extensions. See this question: ElasticBeanstalk - Rails Nokogiri Deployment Issue
Or search for "nokogiri elastic beanstalk" for more answers: https://stackoverflow.com/search?q=nokogiri+elastic+beanstalk
I have a rails app that works on my development box, i am putting it up on heroku and everything works fine except whenever I run a rake db.. command it does the command but at the end it gives me the following error:
/app/vendor/bundle/ruby/2.4.0/gems/activesupport-5.0.2/lib/active_support/dependencies.rb:293:in require': cannot load such file -- /app/db:version (LoadError)
from /app/vendor/bundle/ruby/2.4.0/gems/activesupport-5.0.2/lib/active_support/dependencies.rb:293:inblock in require'
from /app/vendor/bundle/ruby/2.4.0/gems/activesupport-5.0.2/lib/active_support/dependencies.rb:259:in load_dependency'
from /app/vendor/bundle/ruby/2.4.0/gems/activesupport-5.0.2/lib/active_support/dependencies.rb:293:inrequire'
from /app/vendor/bundle/ruby/2.4.0/gems/railties-5.0.2/lib/rails/test_unit/test_requirer.rb:11:in
block in require_files'
from /app/vendor/bundle/ruby/2.4.0/gems/railties-5.0.2/lib/rails/test_unit/test_requirer.rb:10:in
each'
from /app/vendor/bundle/ruby/2.4.0/gems/railties-5.0.2/lib/rails/test_unit/test_requirer.rb:10:in
require_files'
from /app/vendor/bundle/ruby/2.4.0/gems/railties-5.0.2/lib/rails/test_unit/minitest_plugin.rb:86:inplugin_rails_init'
from /app/vendor/bundle/ruby/2.4.0/gems/minitest-5.10.1/lib/minitest.rb:80:in
block in init_plugins'
from /app/vendor/bundle/ruby/2.4.0/gems/minitest-5.10.1/lib/minitest.rb:78:in
each'
from /app/vendor/bundle/ruby/2.4.0/gems/minitest-5.10.1/lib/minitest.rb:78:in
init_plugins'
from /app/vendor/bundle/ruby/2.4.0/gems/minitest-5.10.1/lib/minitest.rb:129:in
run'
from /app/vendor/bundle/ruby/2.4.0/gems/railties-5.0.2/lib/rails/test_unit/minitest_plugin.rb:72:in run'
from /app/vendor/bundle/ruby/2.4.0/gems/minitest-5.10.1/lib/minitest.rb:62:in
block in autorun'
I have tried adding the gems railties and minitest into my gem file. I have deleted my heroku app and started from scratch again.
I have deleted the gemlock file and ran bundle install and bundle check
I have specified the ruby version in my gem file
Below is my gem file
source 'https://rubygems.org'
ruby "2.4.0"
gem 'rake', '~> 12.0'
gem 'railties', '~> 5.0', '>= 5.0.0.1'
gem 'minitest', '~> 5.10', '>= 5.10.1'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.0.0', '>= 5.0.0.1'
# Use mysql as the database for Active Record
#gem 'mysql2', '>= 0.3.18', '< 0.5'
gem 'pg'
# Use Puma as the app server
gem 'puma', '~> 3.0'
# 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.2'
# 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 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.5'
# Use Redis adapter to run Action Cable in production gem 'redis', '~> 3.0' Use ActiveModel has_secure_password gem 'bcrypt', '~> 3.1.7' Use Capistrano for deployment gem 'capistrano-rails', group: :development
gem 'peddler', '~> 1.4.1'
gem 'nokogiri', '~> 1.6', '>= 1.6.8'
gem "pry-rails", group:"development"
gem 'chartkick', '~> 2.1', '>= 2.1.1'
gem "groupdate"
gem 'devise', '~> 4.2'
gem 'omniauth', '~> 1.3', '>= 1.3.1'
#required for devise
gem 'jquery-turbolinks'
#gem 'foundation-rails'
gem 'whenever', require: false
# export to excel
gem 'axlsx_rails', '~> 0.4.0'
gem 'axlsx', '2.1.0.pre'
gem 'roo'
gem 'rubyzip', '~> 1.1.0'
#gem 'zip-zip' #
#gem 'will_paginate', '~> 3.1.0'
#gem 'foundation-datepicker-rails'
gem 'will_paginate', '~> 3.1', '>= 3.1.5'
gem "wysiwyg-rails"
gem "font-awesome-rails"
gem 'stripe'
gem 'stripe_event', '~> 1.5', '>= 1.5.1'
#gem 'koudoku'
gem 'bootstrap-sass', '~> 3.3.6'
gem 'bootstrap-datepicker-rails'
gem "bootstrap-switch-rails"
gem 'elasticemail', git: "git://github.com/klebervirgilio/elasticemail.git"
gem 'rails_admin', '~> 1.1.1'
gem 'cancancan', '~> 1.10'
gem 'ransack', github: 'activerecord-hackery/ransack'
gem 'sidekiq'
#gem 'sinatra', github: 'sinatra/sinatra'
gem 'rails_12factor', group: :production
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug', platform: :mri
end
group :development do
# Access an IRB console on exception pages or by using <%= console %> anywhere in the code.
gem 'web-console'
gem 'listen', '~> 3.0.5' # was causing an error https://github.com/rails/rails/issues/24063 moved outside development group
# 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
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
I am at a loss, thank you
The corrent syntax to run rake tasks on Heroku is heroku run rake db:migrate. In your command you missed run
As I can see you are using rails 5 and have 12factor gem. rails_12factor gem is not required for rails 5 deployment on heroku.
Follow heroku rails 5 deployment documentation and it should solve the issue.
Hope it helps.
I'm not new to rails but was a long time I didn't used it. Today was trying to build something and get this.
I try to run a standard
rails g migration add_user_id_to_posts user:references
And I always get this message in the terminal
Could not find database_cleaner-1.5.3 in any of the sources
Run `bundle install` to install missing gems.
But when I check in the Gemfile I have
source 'https://rubygems.org'
gem 'rails', '>= 5.0.0.rc1', '< 5.1'
gem 'pg', '~> 0.18'
gem 'puma', '~> 3.0'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.1.0'
gem 'jquery-rails'
gem 'turbolinks', '~> 5.x'
gem 'jbuilder', '~> 2.0'
gem 'responders', '~> 2.2'
gem 'devise', '~> 4.1', '>= 4.1.1'
group :development, :test do
gem 'byebug', platform: :mri
gem "rails-controller-testing", :git => "https://github.com/rails/rails-controller-testing"
gem "rspec-rails", "3.5.0.beta3"
end
group :development do
gem 'web-console'
gem 'listen', '~> 3.0.5'
gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0'
end
group :test do
gem 'capybara', '~> 2.7', '>= 2.7.1'
gem 'database_cleaner', '~> 1.5.3'
end
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
I try everything I find in the net. I deleted my Gemfile.lock and do bundle install again. I install the new version of ruby the 2.3.1.
But I can't figured out what to do. If someone can help me with this, would be appreciate.
Find the solution with the help of someone on Slack. I got my spring always running so I have just need to do spring stop and everything work like a charm after.
Thank you all for the help.
I'm trying to install active admin which I was partly successful with. However, I want to use the '0-6-stable' and not the "1.0.0.pre2" version. When I changed my gem file to reflect my change, I get the following error message:
Resolving dependencies...
Bundler could not find compatible versions for gem "formtastic":
In Gemfile:
activeadmin (>= 0) ruby depends on
formtastic (~> 2.0) ruby
formtastic (3.2.0.pre)
Now, I've gotten this message before and I would just delete my Gemfile.lock but it doesn't seem like that is working.
Copy of my gem file:
source 'http://rubygems.org'
ruby '2.2.1'
gem 'ransack', github: 'activerecord-hackery/ransack'
gem 'inherited_resources', github: 'josevalim/inherited_resources'
gem 'formtastic', github: 'justinfrench/formtastic'
gem 'rails', '~> 4.2', '>= 4.2.5'
gem 'railties', '~> 4.2', '>= 4.2.5'
gem 'sqlite3', group: :development
gem 'sass-rails', '~> 4.0.3'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'jquery-rails', '~> 4.0', '>= 4.0.5'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc
gem 'rails_12factor', group: :production
gem 'pg', group: :production
gem 'activeadmin', github: 'activeadmin', branch: '0-6-stable'
#gem 'will_paginate', '~> 3.0'
#gem 'will_paginate-bootstrap'
gem 'carrierwave'
gem "fog"
gem "figaro"
gem 'execjs'
gem 'tzinfo-data', platforms: [:mingw, :mswin]
gem "mini_magick"
gem 'devise'
gem 'searchkick'
group :development, :test do
gem 'rspec-rails', '~> 3.0'
end
The reason I want to use the most stable version of active admin is because I'm getting "NoMethodError in Admin::AdminUsersController#index" when I select "Admin Users" I hoping that using the stable version will correct this issue.
EDIT: The ActiveAdmin Issue: https://github.com/activeadmin/activeadmin/issues/4249
You can't use the 0-6-stable branch, if you use rails >= 4.x, 0-6-stable works only with rails <= 3.x.
This mean's your Gemfile need to look like this:
source 'http://rubygems.org'
ruby '2.2.1'
gem 'rails', '~> 4.2', '>= 4.2.5'
gem 'railties', '~> 4.2', '>= 4.2.5'
gem 'sqlite3', group: :development
gem 'sass-rails', '~> 4.0.3'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'jquery-rails', '~> 4.0', '>= 4.0.5'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc
gem 'rails_12factor', group: :production
gem 'pg', group: :production
gem 'activeadmin', github: 'activeadmin'
#gem 'will_paginate', '~> 3.0'
#gem 'will_paginate-bootstrap'
gem 'carrierwave'
gem "fog"
gem "figaro"
gem 'execjs'
gem 'tzinfo-data', platforms: [:mingw, :mswin]
gem "mini_magick"
gem 'devise'
gem 'searchkick'
group :development, :test do
gem 'rspec-rails', '~> 3.0'
end
From the ActiveAdmin point of view there is no need to use ransack, inherited_resources and formtastic from github.
1: remove Gemfile.lock
2: Add gem 'jquery-rails'
3: add gem 'formtastic'
4: Run bundle install
Still if you have any issue in bundle Github Active Admin ,I would like to say go with rails 3.2.
Hope this help you !!!