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
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 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]
I have an issue with the command
rails g spree:install --user_class=Spree::User
I'm following the Spree guide from github : https://github.com/spree/spree
ans i have the error :
Uninitialize constant ActiveSupport::EventedFileUpdateChecker
I use ruby 2.3.0, rails 4.2.7.1 and Spree 3.0.10
Here my Gemfile:
gem 'rails'#, '~> 5.0.0', '>= 5.0.0.1'
gem 'pg', '~> 0.18'gem
gem 'puma', '~> 3.0'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.2'
gem 'jquery-rails'
gem 'turbolinks', '~> 5'
gem 'jbuilder', '~> 2.5'
group :development, :test do
gem 'byebug', platform: :mri
end
group :development do
gem 'web-console'
gem 'listen', '~> 3.0.5'
gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0'
end
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
gem 'spree_gateway', '~> 3.0.0'
gem 'spree_auth_devise', '~> 3.0.0'
gem 'spree', '~> 3.0.10'
Any Idea ?
I think i found why it don't work. The project was created with rails 5.0.0.1 then i downgrade to 4.7.1 to be able to use spree.
Spree isn't compatible with rails 5 and some files are from the command line to create project on rails 5
I'm not sure at all but i guess i just can't use spree with this project. I must restart
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 am on windows machine while using the command line i get this error
"(Backtrace restricted to imported tasks) cap aborted! LoadError: cannot load such file -- capistrano/passenger C:/Sites/Buy/Capfile:23:in `'
(See full trace by running task with --trace)"
And on git bash with the same command i have this error.
" cap production deploy C:/tools/ruby21/lib/ruby/2.1.0/rubygems.rb:235:in bin_path': can't find gem capistrano ([">= 0.a"]) (Gem::GemNotFoundException)
from C:/RailsInstaller/Ruby2.1.0/bin/cap:22:in'"
The gems i am using.
gem 'rails', '4.1.8'
gem 'sqlite3'
gem 'sass-rails', '~> 4.0.3'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'therubyracer', platforms: :ruby
gem 'rails_12factor', group: :production
gem 'protected_attributes', '~> 1.1', '>= 1.1.3'
gem 'rake', '~> 10.5'
gem 'rake-compiler', '~> 0.9.5'
gem 'rspec', '~> 3.4'
gem 'omniauth-digitalocean', '~> 0.2.0'
gem 'devise', '~> 3.5', '>= 3.5.6'
gem 'bootstrap-sass'
gem 'autoprefixer-rails', '~> 6.3', '>= 6.3.1'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc
gem 'bcrypt', '~> 3.1.7'
gem 'pg'
gem "cf-autoconfig", "~> 0.2.1"
gem 'omniauth', '~> 1.3', '>= 1.3.1'
gem 'json', '~> 1.8', '>= 1.8.3'
gem 'omniauth-twitter', '~> 1.2', '>= 1.2.1'
gem 'omniauth-facebook', '~> 3.0'
platforms :ruby do
gem 'unicorn'
end
group :development do
gem 'capistrano', '~> 3.4'
gem 'capistrano-bundler', '~> 1.1', '>= 1.1.4'
gem 'capistrano-rbenv', '~> 2.0', '>= 2.0.4'
gem 'capistrano-rails', group: :development
end
gem 'tzinfo-data', platforms: [:mingw, :mswin]
I had same error but with:
capistrano/rbenv
I commit the line (in your case 23) in Gapfile and the deploy work with no problems.
You may have included a line in Capfile that is:
require 'capistrano/passenger'
Please remove this line and try again cap production deploy:initial
The new capistrano requires the passenger file but I think you are not using passenger but webrick, puma or unicorn. So that is the reason your cap cannot find passenger.
For more info on deploying rails app to digital ocean ubuntu server with capistrano, puma, nginx complete tutorial available at:
http://sulmanbaig.com/blog/deploy-on-digitalocean-rails-puma-nginx