Update from ruby 2.2.0 to 2.5

Viewed 2441

I have a Rails (4.2.6) project that was written with ruby 2.2.0.

I am trying to upgrade to ruby 2.5. To do that, I changed in the Rails repo, the file .ruby-version to ruby-2.5.0.

In the terminal, the ruby version is correct:

ruby 2.5.0p0 (2017-12-25 revision 61468) [x86_64-darwin17]

When I run

bundle update --bundler 

I get following error:

6 warnings and 2 errors generated.
make: *** [generator.o] Error 1

make failed, exit code 2

Gem files will remain installed in /Users/albert/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/json-1.8.3 for inspection.
Results logged to /Users/albert/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/extensions/x86_64-darwin-17/2.5.0-static/json-1.8.3/gem_make.out

An error occurred while installing json (1.8.3), and Bundler cannot continue.
Make sure that `gem install json -v '1.8.3'` succeeds before bundling.

In Gemfile:
  rails was resolved to 4.2.6, which depends on
    actionmailer was resolved to 4.2.6, which depends on
      actionpack was resolved to 4.2.6, which depends on
        actionview was resolved to 4.2.6, which depends on
          rails-dom-testing was resolved to 1.0.7, which depends on
            rails-deprecated_sanitizer was resolved to 1.0.3, which depends on
              activesupport was resolved to 4.2.6, which depends on
                json

I've tried to update manually the json gem:

gem install json -v '1.8.3' 

Without success:

Getting SRV record failed: DNS result has no information for _rubygems._tcp.gems.rubyforge.org
HEAD http://gems.rubyforge.org/api/v1/dependencies
301 Moved Permanently
HEAD https://rubygems.org
200 OK
Getting SRV record failed: DNS result has no information for _rubygems._tcp.gems.github.com
HEAD http://gems.github.com/api/v1/dependencies
301 Moved Permanently
HEAD http://gems.github.io/api/v1/dependencies
404 Not Found
GET http://gems.github.com/prerelease_specs.4.8.gz
301 Moved Permanently
GET http://gems.github.io/prerelease_specs.4.8.gz
404 Not Found
GET http://gems.github.com/specs.4.8.gz
301 Moved Permanently
GET http://gems.github.io/specs.4.8.gz
404 Not Found
HEAD https://api.rubygems.org/api/v1/dependencies
200 OK
GET https://rubygems.org?gems=json
200 OK
ERROR:  While executing gem ... (TypeError)
    incompatible marshal file format (can't be read)
    format version 4.8 required; 60.33 given

At this point, I don't know what to google, how to debug.

If I run

bundle install

I get following error

    2: from ./bin/bundle:3:in `<main>'
    1: from /Users/albert/.rbenv/versions/2.5.0/lib/ruby/2.5.0/rubygems.rb:263:in `bin_path'
/Users/albert/.rbenv/versions/2.5.0/lib/ruby/2.5.0/rubygems.rb:289:in `find_spec_for_exe': Could not find 'bundler' (1.14.3) required by your /Users/albert/localDocuments/CodingArea/Clients/hanspeter/book/Gemfile.lock. (Gem::GemNotFoundException)
To update to the lastest version installed on your system, run `bundle update --bundler`.
To install the missing version, run `gem install bundler:1.14.3`

Not sure what this means, what I have in the Gemfile.lock is:

bundler (>= 1.3.0, < 2.0)

And, im my Gemfile, I have as a source:

source 'https://rubygems.org'
```

As far as I understood, bundle is a gem manager that works on Mac, and bundler is a gem that manages gems?
1 Answers

It is because you have wrong gem resources.

Try these to correct it

gem sources -r  http://gems.rubyforge.org/
gem sources -r http://gems.github.com
gem sources -a https://rubygems.org/

Then bundle again as you did

Related