Upgrading from Rails 5.2.8.1 to Rails 6 - ruby-on-rails

I'm trying to upgrade an old project into new versions of ruby and rails.
ruby 2.5.1 -> ruby 3.1.2
rails 5.2.8.1 -> rails 6.0.3
This is the error im getting:
$ bundle
Fetching gem metadata from https://rubygems.org/..........
Resolving dependencies.....
Bundler could not find compatible versions for gem "actionpack":
In snapshot (Gemfile.lock):
actionpack (= 5.2.8.1)
In Gemfile:
rails (~> 6.0.3) was resolved to 6.0.3, which depends on
actionpack (= 6.0.3)
devise_token_auth (= 1.0.0) was resolved to 1.0.0, which depends on
devise (> 3.5.2, < 4.6) was resolved to 4.5.0, which depends on
railties (>= 4.1.0, < 6.0) was resolved to 5.2.8.1, which depends on
actionpack (= 5.2.8.1)
Deleting your Gemfile.lock file and running `bundle install` will rebuild your snapshot from scratch, using only
the gems in your Gemfile, which may resolve the conflict.
$ rails s
Could not find gem 'rails (~> 6.0.3)' in locally installed gems.
The source contains the following gems matching 'rails':
* rails-5.2.8.1
Run `bundle install` to install missing gems.
I was hoping to update my old rails project into newer versions of ruby and rails including working dependencies.

The Devise gem didn't support Ruby on Rails 6.0 until version 4.7. That means when you want to update Rails to 6.0 then you need to update Devise at the same time.
I would try running:
bundle update rails device devise_token_auth
Btw. Rubygems is a great resource to investigate version dependencies. Here, for example, you can see that Devise 4.6.2 only support railties < 6.0 but Devise 4.7.0 had that limitation removed.

Related

Solidus installation issue with rails 6

I have been trying out to install Solidus on my mac, for which i followed the documentation, https://guides.solidus.io/developers/getting-started/first-time-installation.html
I am using ruby version ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-darwin18] and rails version 6.0.0
After adding
gem 'solidus'
gem 'solidus_auth_devise'
While trying bundle install I am facing the following issue
Bundler could not find compatible versions for gem "actionpack":
In snapshot (Gemfile.lock):
actionpack (= 6.0.0)
In Gemfile:
rails (~> 6.0.0) was resolved to 6.0.0, which depends on
actionpack (= 6.0.0)
solidus was resolved to 2.5.0.beta1, which depends on
solidus_core (= 2.5.0.beta1) was resolved to 2.5.0.beta1, which depends on
actionpack (~> 5.1.0)
Running `bundle update` will rebuild your snapshot from scratch, using only
the gems in your Gemfile, which may resolve the conflict.
Bundler could not find compatible versions for gem "rails":
In snapshot (Gemfile.lock):
rails (= 6.0.0)
In Gemfile:
rails (~> 6.0.0)
solidus was resolved to 1.0.0.pre, which depends on
solidus_core (= 1.0.0.pre) was resolved to 1.0.0.pre, which depends on
rails (~> 4.2.0)
Running `bundle update` will rebuild your snapshot from scratch, using only
the gems in your Gemfile, which may resolve the conflict.
Am I missing something or messed up with rails version? I can understand that it requries rails version 5.1.0, but is there no support for rails 6 with solidus.
Solidus 2.10.0.beta1 has just been released. This way you can try it out with Rails 6 as well by using:
gem 'solidus', '~> 2.10.0.beta1'
in your Gemfile.

updating rails 4.2.5 to rails 5, keep having ActiveModel dependencies issues

when updating a rails 4.2.5 app (thats in production on heroku) to rails 5, i keep running into the below incompatible version for the gem, i've tried the bundle update, bundle install, done everything asked by the upgrade docs on rails site and stackoverflow.
Bundler could not find compatible versions for gem "activemodel":
In snapshot (Gemfile.lock):
activemodel (= 5.0.0)
In Gemfile:
active_model-errors_details was resolved to 1.3.0, which depends
on
activemodel (< 5.0.0.beta1, >= 3.2.13)
carrierwave was resolved to 1.2.2, which depends on
activemodel (>= 4.0.0)
rails (= 5.0.0) was resolved to 5.0.0, which depends on
activemodel (= 5.0.0)
web-console (~> 2.0) was resolved to 2.3.0, which depends on
activemodel (>= 4.0)
Running `bundle update` will rebuild your snapshot from scratch,
using only
the gems in your Gemfile, which may resolve the conflict.
There is no version of the active_model-errors_details that supports Ruby on Rails 5.x (see its Rubygems page).
But the documentation of the active_model-errors_details says that it is a feature backported from Rails 5.0 to use with Rails 3.2.x and 4.x apps.
Therefore I think there is no need to keep that gem in your application once you update to Ruby 5.0. Just remove the gem 'active_model-errors_details' line from your Gemfile and run bundle install again.

Gem dependencies incompatibality during upgrade of rails 4.2.10 to rails 5.0.0

I am in a middle of a process of upgrading our rails 4 app.
Following the rails upgrade guide, I have updated current rails version in a gemfile replacing 4.2.10 with 5.0.0.
But after running bundle update rails, I am getting many incompatibility issues even after running 4.2.10 (with rails 4.2.10) which should update all gems to the latest version.
Following are the compatibility errors I am getting after running bundle update rails with rails 5.0.0 in a gemfile:
Bundler could not find compatible versions for gem "actionpack":
In Gemfile:
active_link_to was resolved to 1.0.3, which depends on
actionpack
active_model_serializers was resolved to 0.10.2, which depends on
actionpack (< 6, >= 4.1)
inherited_resources was resolved to 1.6.0, which depends on
actionpack (< 5, >= 3.2)
inherited_resources was resolved to 1.6.0, which depends on
actionpack (< 5, >= 3.2)
kaminari was resolved to 0.17.0, which depends on
actionpack (>= 3.0.0)
rails (= 5.0.0) was resolved to 5.0.0, which depends on
actionpack (= 5.0.0)
rails (= 5.0.0) was resolved to 5.0.0, which depends on
actionpack (= 5.0.0)
rspec-rails (= 3.6.0) was resolved to 3.6.0, which depends on
actionpack (>= 3.0)
What is your question?
Before update a gem you have to check if your project code and dependencies are ready for this changes, not an easy process if this is a big app.
1. Come back to de rails version you had.
gem install <gem> -v=<version>
e.g.
gem install rails -v=4.2
This way your rails app should use the version you want.
2. Update the rest of the gems... (not recommend it if you are not sure about the new releases)
Check your Gemfile.lock:
bundle update
Or delete your Gemfile.lock (it will be rebuild automatically when you try to start your rails app).
Finally after many trials & testing, I was able to run bundle install. Listing steps that I tried-
1. Create a new demo rails app using rails new with rails 5.
2. Remove existing Gemfile.lock.
3. Remove all current gems: (I used for i in gem list --no-versions; do gem uninstall -aIx $i; done command referenced from here.)
4. Replace existing Gemfile with the new one that was generated from creating new rails 5 app. (assuming you'll be having a backup copy of existing Gemfile.)
5. Copy individual gems from old file to the new one.
6. Run bundle install. (You should be having a :) after this execution.)
7. Run rails app:update to continue with the upgrade process.

bundle install error Bundler could not find compatible versions for gem "actionpack": In GemFile: irwi was resolved to 0.5.0

please help me with this bundle install error....
Resolving
dependencies...............................................................
Bundler could not find compatible versions for gem "actionpack":
In Gemfile:
irwi was resolved to 0.5.0, which depends on
actionpack (>= 4.0)
rails (= 3.1.4) was resolved to 3.1.4, which depends on actionpack
(= 3.1.4)
You must either update your Rails version (this will update your actionpack) or downgrade irwi to an old version which is compatible with Rails 3.1.4
I strongly recommend updating Rails
According to docs for irwi (README) and gemspec
Irwi is a Ruby on Rails 4 plugin which adds wiki functionality to your application.
it seems like it will work only with RoR 4+

Rails gem for adding an on site tutorial supported for rails 4

I'm attempting to add an on boarding tutorial to my site. I've installed the joyride-rails gem and am getting this error when running bundle install.
Bundler could not find compatible versions for gem "rails":
In Gemfile:
joyride-rails (~> 0.0.14) ruby depends on
rails (~> 3.1) ruby
rails (4.1.6)
I've done some research and found this answer Dependency error while installing the gem "joyride-rails"
And this answer Simple Javascript Joyride plugin in rails
The problem is I think that the joyride gem just isn't compatible with rails 4 and when I down grade to 3.1 a bunch of my other gems are in conflict. I delte the gemfile.lock and run bundle install and get this error.
Bundler could not find compatible versions for gem "railties":
In Gemfile:
coffee-rails (~> 4.0.0) ruby depends on
railties (< 5.0, >= 4.0.0.beta) ruby
rails (= 3.1) ruby depends on
railties (3.1.0)
Any suggestions as to how I can implement this gem? Or do you know of another Gem that will accomplish the same goal?
Thanks!

Resources