I'm doing some work with an old code base that was running Ruby 1.9.3 and Rails 3.2.3. However, I had to update to Ruby 2 (I chose 2.1.5, because I've used it in the past) to fix an SSL error that arose when using the PayPal API (my task was to implement PayPal for credit card processing). This caused an error with the asset pipeline, and after some investigation I discovered that Rails 3.2.3 didn't support Ruby 2.1.5, so I had to upgrade to Rails 3.2.19.
Everything was working fine on my local machine. When it came time to deploy, I installed rbenv on the server (it didn't have RVM or rbenv) and installed Ruby 2.1.5.
Now, the deploy script gets past bundle install, but when it tries to execute cd /var/www/cappwww/current && RAILS_ENV=production script/delayed_job stop, it chokes and says Could not find *** in any of the sources (Bundler::GemNotFound).
"***" is just a placeholder; this happened first with i18n, then multi_json. I manually changed the requested versions of these gems and ran bundle update, and it seemed to work. However, it is now requesting activesupport 3.2.3, and I can't force it to use that because Rails 3.2.19 requires activesupport 3.2.19.
As far as I can tell, this isn't an issue of delayed_job actually requiring these gems, because 1) they would be installed during bundle install, or bundle install would complain if there was an unresolvable dependency, and 2) delayed_job requires activesupport >= 3 according to rubygems, so 3.2.19 should do just fine.
It seems that for some reason, the delayed_job script is looking for a very specific gemset, specifically the old gemset. However, I have no idea what could be causing it to do that.
My Gemfile is
source 'http://rubygems.org'
gem 'rake', '10.1.1'
gem 'rmagick'
gem 'rails', '3.2.19'
gem 'devise', '2.0'
gem 'haml', '3.1.4'
gem 'sass', '3.2.3'
gem 'formtastic', '2.1.0.rc'
gem 'cocaine', '0.3.2'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
#gem 'mysql2', '0.2.6'
gem 'mysql2', '0.3.11'
#gem 'less', '~> 2.0.8'
gem 'less', '~> 2.2.1'
gem 'tinymce-rails', '3.5.8'
gem 'will_paginate', '3.0.3'
gem 'country_select', '1.0.1'
gem 'paypal-sdk-rest'
# Use unicorn as the web server
gem 'unicorn'
gem 'jquery-rails', '2.1.4'
gem 'paperclip', '3.2.1'
gem 'feedzirra', '0.0.24'
gem 'delayed_job', '4.1.0'
gem 'delayed_job_active_record', '4.1.0'
gem 'daemons', '1.1.9'
gem 'therubyracer', '0.12.0'
# To use debugger (ruby-debug for Ruby 1.8.7+, ruby-debug19 for Ruby 1.9.2+)
# gem 'ruby-debug'
# gem 'ruby-debug19'
# Bundle the extra gems:
# gem 'bj'
# gem 'nokogiri'
# gem 'sqlite3-ruby', :require => 'sqlite3'
# gem 'aws-s3', :require => 'aws/s3'
gem 'rsolr', '1.0.7'
gem 'sunspot', '1.3.3'
gem 'sunspot_solr', '1.3.3'
gem 'sunspot_rails', '1.3.3'
gem 'hpricot', '0.8.6'
gem 'roadie', '2.3.4'
group :assets do
gem 'sass-rails'
gem 'uglifier'
end
# Bundle gems for the local environment. Make sure to
# put test-only gems in this group so their generators
# and rake tasks are available in development mode:
group :development, :test do
# Deploy with Capistrano
gem 'capistrano', '2.13.5'
gem 'capistrano-rbenv'
gem 'rspec-rails', '~> 2.6'
gem 'machinist', '2.0'
gem 'faker', '1.0.1'
gem 'syntax', '1.0.0'
gem 'progress_bar', '0.4.0'
end
group :development do
gem 'active_record_query_trace', '1.1'
end
Any help would be greatly appreciated, as I'm in pretty far over my head.
Well, I figured it out. The RAILS_ENV=production script/delayed_job stop command was executing in the current folder, which is the previous release. Since I was using rbenv to force Ruby 2.1.5, the gems for the previous release had not been installed for the current version of Ruby, which is why delayed_job was complaining. Running bundle install in the current directory fixed the issue.
Related
I want to upgrade an old legacy app from rails 5.0 to rails 5.1 then so on until rails 7
I have dockerized the app for easiness
please read the Gemfile, which gems are supported in Rails 7
terminal:
$ docker-compose run rails bundle install
terminal logs:
An error occurred while installing nio4r (2.5.8), and Bundler cannot continue.
In Gemfile:
rename was resolved to 1.0.8, which depends on
rails was resolved to 5.2.8.1, which depends on
actioncable was resolved to 5.2.8.1, which depends on
nio4r
this is my Gemfile: app/Gemfile
I have removed the Gemfile.lock to avoid conflicts in version that were locked
source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
gem 'rails', '~> 5.1'
gem 'mysql2'
gem 'sassc'
gem 'sass'
# gem 'sass-rails', git:'https://github.com/sass/sassc-rails.git', branch: 'master'
gem 'sassc-rails'
gem 'uglifier'
gem 'coffee-rails'
gem 'jquery-rails'
gem 'jquery-ui-rails'
gem 'turbolinks'
gem 'jquery-turbolinks'
gem 'js_cookie_rails'
gem 'jbuilder'
gem 'sdoc', group: :doc
gem 'rake'
gem 'kaminari'
gem 'slim-rails'
gem 'rack-user_agent'
gem 'gmail'
gem 'whenever'
gem 'actionpack-action_caching'
gem 'breadcrumbs_on_rails'
gem 'execjs'
gem 'ltsv-logger'
gem 'therubyracer'
# 問い合わせなどの画像認証
gem 'scout_apm'
gem "recaptcha", require: "recaptcha/rails"
gem 'sentry-raven'
gem 'faraday'
gem 'faraday_middleware'
gem 'config'
gem 'font-awesome-rails'
Are you working from the Rails guide for updating versions?
Don't start with Rails 7 in mind. Just do one minor version bump at a time (5.1, 5.2, 6.0 etc... you don't have to worry about patch numbers) and make sure it works in production before moving on.
Also, if there are changes that break in version x.x, you can usually make those changes in x.x-1 before you upgrade to x.x. I suggest doing as much as you can before you get to the point of upgrading Rails and other gems.
In this case, is your app already working with Rails 5.1 (and how have you evaluated that)?
Bundler is trying to install Rails 5.2 because rails '~> 5.1' will find the latest 5.x version that is equal or greater than 5.1. If you're not sure your app is working on 5.1 yet, start there by adding a patch version so you get the latest 5.1.x: `gem 'rails', '~> 5.1.0'.
Once you've got the version number right in your Gemfile, you're on to the next step of the guide:
Change the Rails version number in the Gemfile and run bundle update
(now do the rest of the steps)
I'm working on a project which I normally work on Mac OSX. I'm on ruby MRI V.1.9.3-p194 and rails v.3.2.8.
but, for the time being, there has been a need to collaborate the project source code with another team member who's using windows.
I proceeded on to set up everything on my colleague's windows machine and almost everything seems to work quite well, the same ruby and rails framework version are used. I managed to get 'bundle install' to pass by having most of their dependencies resolved. (So, you can imagine that the versions of gems have got updated from those on my Mac Machine)
I also have node.js installed on my colleague's machine in order to make ruby able to run javascript.
A while later, it seemed I was able to start the web server using "bundle exec thin start" and it's starting without any error. The other reason, I'm quite sure my setup's been coming in the right way
because I can retrieve model records via rail console beautifully. But I'm only getting one error, every time I try to browse to the app on the web browser.
Every time I'm getting node.js dependency error "cannot find module 'stylus'"
that even prevents me from getting the login page loaded.
here is a snapshot of the error I get:
also, I'm happy to share you my Gemfile, so it could give you more clues what actually goes wrong? it can be found below:
source 'http://rubygems.org'
gem 'rails', '3.2.8'
gem 'rubyzip', '< 1.0.0'
gem 'roo','1.12.1'
gem 'mysql2', '0.3.11'
gem 'jquery-rails', '2.1.2'
gem 'haml', '3.1.7'
gem 'thin', '1.4.1'
group :development do
gem 'capistrano', '2.13.4'
end
gem 'devise', '2.1.2'
gem 'devise-async', '0.5.0'
gem 'cancan', '1.6.8'
gem 'simple_form', '2.0.4'
gem 'cocoon', '1.1.1'
gem 'inherited_resources', '1.3.1'
gem 'will_paginate', '3.0.3'
gem 'bootstrap-will_paginate', '0.0.9'
gem 'mechanize', '2.5.1'
gem 'delayed_job', '3.0.4'
gem 'paperclip', '3.4.0'
gem 'spreadsheet', '0.6.4.1'
gem 'geocoder', '1.1.6'
gem 'whenever', '0.8.2'
gem 'american_date', '1.0.0'
gem 'money','5.1.1'
gem 'rets','0.5.1'
gem 'haversine','0.3.0'
gem 'capybara'
gem 'poltergeist'
gem 'selenium-webdriver'
gem 'redis'
gem 'execjs','2.0.0'
group :assets do
gem 'stylus', '0.7.1'
gem 'coffee-rails', '3.2.2'
gem 'uglifier', '1.3.0'
end
What should I do to get this to work? Any help would be greatly appreciated.
Updated:
I updated my question rgrd Brad suggestion accordingly.
I've performed as suggested. but when I have node.js uninstalled, I rather got another error like below "The node.js runtime is not available". any idea?
You can see the answer here
I changed from coffee-script-source 1.12.2 to 1.8.0 in Gemfile.lock file.
ex) coffee-script-source (1.8.0)
And then, in cmd, I put a command like 'bundle install'.
If you do not have a bundle, you can install bundle such as
gem install bundle
Finally, turn off your rails server and turn on again.
Thank you.
I am building a rails app and was using rails 4.0.1.
I had an error and noticed that it was mentioned as a bug on rails 3 months ago so I decided to: bundle update and got rails 4.0.3
after doing so neither the tests nor the server would start and they throw an error:
gems/railties-4.0.3/lib/rails/railtie/configuration.rb:95:in `method_missing': undefined method `action_mailer' for # (NoMethodError)
For the moment I commented out the action_mailer lines in the config/environments/* but it would be good to find a real solution.
Searching on Google didn't yield anything regarding this specific error.
Please let me know if I can provide any more detail.
Thank you very much.
UPDATE: here is my Gemfile
source 'https://rubygems.org'
ruby '2.0.0'
gem 'bootstrap-sass'
gem 'bootstrap_form'
gem 'coffee-rails'
gem 'rails'
gem 'haml-rails'
gem 'sass-rails'
gem 'uglifier'
gem 'jquery-rails'
gem 'bcrypt-ruby', '~> 3.1.2'
group :development do
gem 'sqlite3'
gem 'thin'
# gem "better_errors"
gem "binding_of_caller"
end
group :production do
gem 'pg'
gem 'rails_12factor'
end
group :development, :test do
gem 'rspec-rails'
gem 'pry'
gem 'pry-nav'
end
group :test do
gem "faker"
gem "capybara"
gem "database_cleaner"
gem "launchy"
gem 'shoulda-matchers'
gem "selenium-webdriver"
gem "fivemat"
gem 'fabrication'
end
Solution found, in case anyone lands here:
The main issue was that in my Gemfile as you can see no specific gem version was set (apart from bcrypt)
Somehow this makes bundle installs outdated versions under circumstances that are not yet clear to me.
Steps to fix:
completely remove the gemset (if you are using one) or uninstall all
gems
remove the Gemfile.lock
specifiy what version of rails you need e.g. 'rails', '~> 4.0.3'
bundle install
you are set :)
in my case I had installed the gems and since the devkit was not installed properly the gems did not compile.
After setting up the devkit I had to uninstall all of the rails gems (actionmailer, activerecord, actioncable......) and then install rails again.
Then it worked.
I am receiving an error while bundle install my updates. Here is my gemfile:
source 'https://rubygems.org'
gem 'rails', '3.2.1'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'mysql2'
gem 'libv8'
gem 'therubyracer'
gem 'haml'
gem 'haml-rails'
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
gem 'compass-rails'
gem 'chosen-rails'
gem "bootstrap-wysihtml5-rails", "~> 0.3.1.10"
gem 'hpricot'
gem "rest-open-uri", "~> 1.0.0"
gem 'jquery-datatables-rails', github: 'rweng/jquery-datatables-rails'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer'
gem 'uglifier', '>= 1.0.3'
gem "commonjs", "~> 0.2.6"
gem "less", "~> 2.2.2"
gem "less-rails", "~> 2.2.6"
end
gem 'jquery-rails'
gem 'simple_form'
gem 'client_side_validations'
gem 'client_side_validations-simple_form'
# To use ActiveModel has_secure_password
gem 'bcrypt-ruby', '~> 3.0.0'
Here is an error i am getting after running bundle install command on production:
An error occured while installing therubyracer (0.11.0), and Bundler
cannot continue. Make sure that gem install therubyracer -v '0.11.0'
succeeds before bundling.
I did the following that worked for me:
I commented out therubyracer from my Gemfile
ran "bundle install"
installed the newest version of therubyracer using "gem install therubyracer" (at the time of writing this is 0.11.2)
I uncommented therubyracer to put it back in to my Gemfile
ran "bundle install" again and everything works
Including libv8 in the Gemfile seems to be a fix to that:
gem 'libv8', '~> 3.11.8.3'
via https://github.com/cowboyd/therubyracer/issues/215
I did a gem uninstall therubyracer & gem uninstall libv8, then remove libv8 from the gemfile and just use therubyracer, then run 'bundle install'
group :assets do
gem 'therubyracer'
end
If it still does not work, just try to intall NodeJS
probably, your libv8 version and therubyracer version are not matching.
So, either you can include proper libv8 version in the Gemfile, which is similar to the
jibiel's solution
gem 'libv8', '~> 3.11.8.3'
But, I would prefer to do these two steps, So, that you don't have to worry about finding proper version of libv8:
Gemfile
gem 'therubyracer'
terminal
gem uninstall libv8
bundle install
And, that is what I have done to solve my same problem
i get Passenger error on shared hosting
Could not find i18n-0.6.0 in any of the sources (Bundler::GemNotFound)
but if i run "bundle install" it says everything is ok :(
and the contents of the Gemfile are:
source 'http://rubygems.org'
gem 'rake', '0.8.7'
gem 'tzinfo', '0.3.27'
gem 'mail', '2.2.16'
gem 'arel', '2.0.9'
gem 'rack', '1.2.2'
gem 'i18n', '0.6.0'
gem 'rails', '3.0.5'
gem 'mysql2'
gem 'paperclip'
gem 'devise'
gem 'jquery-rails'
gem 'acts-as-taggable-on'
gem "will_paginate", "~> 3.0.pre2"
gem 'tiny_mce'
gem "oa-oauth", :require => "omniauth/oauth"
gem "acts_as_list"
"bundle show i18n" gives
/usr/lib/ruby/gems/1.8/gems/i18n-0.6.0
is it the error in my app or error of the hosting? how do i solve it?
it was hosting service bug. here's their reply:
"Passenger and the shell are on two different servers. i18n was installed on
Passenger, however the version was not 0.6.0."
so as i suspected different gems were used for passenger than the ones bundler used