Ruby Upgrade Issues - ruby-on-rails

I upgraded my ruby gem and rails to the latest version. Fixed all the dependencies but still, I am unable to start my rails application.
When I try rails s, I get the below error. I am not sure how to fix this. Any help would be appreciated.
=> Booting WEBrick
=> Rails 4.1.7 application starting in development on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
=> Notice: server is listening on all interfaces (0.0.0.0). Consider using 127.0.0.1 (--binding option)
=> Ctrl-C to shutdown server
/Users/sri/.rvm/gems/ruby-2.5.1/gems/activesupport-4.1.7/lib/active_support/core_ext/numeric/conversions.rb:121: warning: constant ::Fixnum is deprecated
/Users/sri/.rvm/gems/ruby-2.5.1/gems/activesupport-4.1.7/lib/active_support/core_ext/numeric/conversions.rb:121: warning: constant ::Bignum is deprecated
Exiting
Traceback (most recent call last):
5437: from bin/rails:3:in `<main>'
5436: from bin/rails:3:in `load'
5435: from /Users/sri/Documents/imcmarketplace/bin/spring:16:in `<top (required)>'
5434: from /Users/sri/Documents/imcmarketplace/bin/spring:16:in `require'
5433: from /Users/sri/.rvm/gems/ruby-2.5.1/gems/spring-1.7.2/lib/spring/binstub.rb:11:in `<top (required)>'
5432: from /Users/sri/.rvm/gems/ruby-2.5.1/gems/spring-1.7.2/lib/spring/binstub.rb:11:in `load'
5431: from /Users/sri/.rvm/gems/ruby-2.5.1/gems/spring-1.7.2/bin/spring:49:in `<top (required)>'
5430: from /Users/sri/.rvm/gems/ruby-2.5.1/gems/spring-1.7.2/lib/spring/client.rb:30:in `run'
... 5425 levels...
4: from /Users/sri/.rvm/gems/ruby-2.5.1/gems/activesupport-4.1.7/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
3: from /Users/sri/.rvm/gems/ruby-2.5.1/gems/activesupport-4.1.7/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
2: from /Users/sri/.rvm/gems/ruby-2.5.1/gems/activesupport-4.1.7/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
1: from /Users/sri/.rvm/gems/ruby-2.5.1/gems/activesupport-4.1.7/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
/Users/sri/.rvm/gems/ruby-2.5.1/gems/activesupport-4.1.7/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>': stack level too deep (SystemStackError)
Thanks
Sri

I think the problem is related to your ruby and rails version and I think you need to downgrade ruby version or upgrade the rails version
for more check here Ruby 2.4 and Rails 4 stack level too deep (SystemStackError)

To resolve this issue goto Gemfile use gem 'spring' don't add the version of the spring. Then do the bundle install. Still, you have an issue remove the Gemfile.lock then do the bundle install. I hope this will help you.

Related

Rails - Ruby 3.1.1 will not load on CentOS but okay on OSX

I have a rails app that runs fine on my development iMac (Ventura). I pushed to production CentOS7. It bundled up fine but when trying to to assets precompile I get the error below. I have tried, removing lock file and re-bundling, updating bundler, did gem update and did yum update on server. I get the following when doing rake assets:clean precompile and I see similar error in apache log as well. I am running rails 7.0.4.2 and ruby 3.1.1. I need some guidance on how to resolve.
rake assets:clean precompile
rake aborted!
LoadError: cannot load such file -- Version
<internal:/usr/local/rvm/rubies/ruby-3.1.1/lib/ruby/site_ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:37:in `require'
<internal:/usr/local/rvm/rubies/ruby-3.1.1/lib/ruby/site_ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:37:in `require'
/usr/local/rvm/gems/ruby-3.1.1/gems/zeitwerk-2.6.6/lib/zeitwerk/kernel.rb:38:in `require'
/admin/bin/rails/catering_bk/config/initializers/active_admin.rb:290:in `block in <top (required)>'
/usr/local/rvm/gems/ruby-3.1.1/gems/activeadmin-2.13.1/lib/active_admin.rb:68:in `setup'
/admin/bin/rails/catering_bk/config/initializers/active_admin.rb:1:in `<top (required)>'
/usr/local/rvm/gems/ruby-3.1.1/gems/railties-7.0.4.2/lib/rails/engine.rb:667:in `load'
/usr/local/rvm/gems/ruby-3.1.1/gems/railties-7.0.4.2/lib/rails/engine.rb:667:in `block in load_config_initializer'
/usr/local/rvm/gems/ruby-3.1.1/gems/activesupport-7.0.4.2/lib/active_support/notifications.rb:208:in `instrument'
/usr/local/rvm/gems/ruby-3.1.1/gems/railties-7.0.4.2/lib/rails/engine.rb:666:in `load_config_initializer'
/usr/local/rvm/gems/ruby-3.1.1/gems/railties-7.0.4.2/lib/rails/engine.rb:620:in `block (2 levels) in <class:Engine>'
/usr/local/rvm/gems/ruby-3.1.1/gems/railties-7.0.4.2/lib/rails/engine.rb:619:in `each'
/usr/local/rvm/gems/ruby-3.1.1/gems/railties-7.0.4.2/lib/rails/engine.rb:619:in `block in <class:Engine>'
/usr/local/rvm/gems/ruby-3.1.1/gems/railties-7.0.4.2/lib/rails/initializable.rb:32:in `instance_exec'
/usr/local/rvm/gems/ruby-3.1.1/gems/railties-7.0.4.2/lib/rails/initializable.rb:32:in `run'
/usr/local/rvm/gems/ruby-3.1.1/gems/railties-7.0.4.2/lib/rails/initializable.rb:61:in `block in run_initializers'
/usr/local/rvm/gems/ruby-3.1.1/gems/railties-7.0.4.2/lib/rails/initializable.rb:50:in `each'
/usr/local/rvm/gems/ruby-3.1.1/gems/railties-7.0.4.2/lib/rails/initializable.rb:50:in `tsort_each_child'
/usr/local/rvm/gems/ruby-3.1.1/gems/railties-7.0.4.2/lib/rails/initializable.rb:60:in `run_initializers'
/usr/local/rvm/gems/ruby-3.1.1/gems/railties-7.0.4.2/lib/rails/application.rb:372:in `initialize!'
/admin/bin/rails/catering_bk/config/environment.rb:5:in `<top (required)>'
<internal:/usr/local/rvm/rubies/ruby-3.1.1/lib/ruby/site_ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:37:in `require'
<internal:/usr/local/rvm/rubies/ruby-3.1.1/lib/ruby/site_ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:37:in `require'
/usr/local/rvm/gems/ruby-3.1.1/gems/zeitwerk-2.6.6/lib/zeitwerk/kernel.rb:38:in `require'
/usr/local/rvm/gems/ruby-3.1.1/gems/railties-7.0.4.2/lib/rails/application.rb:348:in `require_environment!'
/usr/local/rvm/gems/ruby-3.1.1/gems/railties-7.0.4.2/lib/rails/application.rb:511:in `block in run_tasks_blocks'
/usr/local/rvm/gems/ruby-3.1.1/gems/sprockets-rails-3.4.2/lib/sprockets/rails/task.rb:61:in `block (2 levels) in define'
/usr/local/rvm/gems/ruby-3.1.1/bin/ruby_executable_hooks:22:in `eval'
/usr/local/rvm/gems/ruby-3.1.1/bin/ruby_executable_hooks:22:in `<main>'
Tasks: TOP => environment
(See full trace by running task with --trace)
As noted above. I tried
Remove lock file and bundle again.
gem update
yum update
Also to note this is also an older app that was upgraded to be in compliance with Veracode. It works perfectly on OSX, so the issue must be within CentOS.

Ruby 2.4.1 - warning: constant ::Fixnum is deprecated [duplicate]

This question already has answers here:
Ruby 2.4 and Rails 4 stack level too deep (SystemStackError)
(3 answers)
Closed 5 years ago.
I'm new to StackOverflow and Rails, so I am hoping this is not too naive a question. I am trying to run my application locally using bin/rails server. When I type that, I receive the following trace:
=> Booting Puma
=> Rails 4.2.5 application starting in development on http://localhost:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
/Users/name/.rvm/gems/ruby-2.4.1/gems/activesupport-4.2.5/lib/active_support/core_ext/numeric/conversions.rb:121: warning: constant ::Fixnum is deprecated
/Users/name/.rvm/gems/ruby-2.4.1/gems/activesupport-4.2.5/lib/active_support/core_ext/numeric/conversions.rb:121: warning: constant ::Bignum is deprecated
Exiting
/Users/name/.rvm/gems/ruby-2.4.1/gems/activesupport-4.2.5/lib/active_support/core_ext/numeric/conversions.rb:125:in `block (2 levels) in <class:Numeric>': stack level too deep (SystemStackError)
from /Users/name/.rvm/gems/ruby-2.4.1/gems/activesupport-4.2.5/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
from /Users/name/.rvm/gems/ruby-2.4.1/gems/activesupport-4.2.5/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
from /Users/name/.rvm/gems/ruby-2.4.1/gems/activesupport-4.2.5/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
from /Users/name/.rvm/gems/ruby-2.4.1/gems/activesupport-4.2.5/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
from /Users/name/.rvm/gems/ruby-2.4.1/gems/activesupport-4.2.5/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
from /Users/name/.rvm/gems/ruby-2.4.1/gems/activesupport-4.2.5/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
from /Users/name/.rvm/gems/ruby-2.4.1/gems/activesupport-4.2.5/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
from /Users/name/.rvm/gems/ruby-2.4.1/gems/activesupport-4.2.5/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
... 5603 levels...
from /Users/name/.rvm/rubies/ruby-2.4.1/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:68:in `require'
from /Users/name/spending-tracker-master/bin/spring:13:in `<top (required)>'
from bin/rails:3:in `load'
from bin/rails:3:in `<main>'
I do not believe I can ignore it as stated here (warning: constant ::Fixnum is deprecated When generating new model) because it won't open the application locally.
Could someone help?
Thank you!
Ben
Ruby 2.4 unified Fixnum and Bignum into a single class Integer. When Rails (ActiveSupport's core extensions to be precise) attempts to monkey-patch the aforementioned classes, an error occurs.
This was fixed in Rails 5, and the fix was also backported to Rails 4.2 with version 4.2.8:
Hi everyone,
I am happy to announce that Rails 4.2.8 has been released.
This is the first version of the 4.2 series that officially support
Ruby 2.4.
All you have to do is upgrading Rails from 4.2.5 to Rails 4.2.8.

While running the server in rails with ubuntu os am getting the following error in my local machine?

=> Booting WEBrick
=> Rails 4.0.0 application starting in development on http://0.0.0.0:3000
=> Run rails server -h for more startup options
=> Ctrl-C to shutdown server
Exiting
/home/rank/.rvm/rubies/ruby-2.0.0-p643/lib/ruby/2.0.0/fileutils.rb:245:in mkdir': File exists - /home/rank/rails/chethan/specslot/tmp/pids (Errno::EEXIST)
from /home/rank/.rvm/rubies/ruby-2.0.0-p643/lib/ruby/2.0.0/fileutils.rb:245:infu_mkdir'
from /home/rank/.rvm/rubies/ruby-2.0.0-p643/lib/ruby/2.0.0/fileutils.rb:219:in block (2 levels) in mkdir_p'
from /home/rank/.rvm/rubies/ruby-2.0.0-p643/lib/ruby/2.0.0/fileutils.rb:217:inreverse_each'
from /home/rank/.rvm/rubies/ruby-2.0.0-p643/lib/ruby/2.0.0/fileutils.rb:217:in block in mkdir_p'
from /home/rank/.rvm/rubies/ruby-2.0.0-p643/lib/ruby/2.0.0/fileutils.rb:203:ineach'
from /home/rank/.rvm/rubies/ruby-2.0.0-p643/lib/ruby/2.0.0/fileutils.rb:203:in mkdir_p'
from /home/rank/.rvm/gems/ruby-2.0.0-p643/gems/railties-4.0.0/lib/rails/commands/server.rb:71:inblock in start'
from /home/rank/.rvm/gems/ruby-2.0.0-p643/gems/railties-4.0.0/lib/rails/commands/server.rb:70:in each'
from /home/rank/.rvm/gems/ruby-2.0.0-p643/gems/railties-4.0.0/lib/rails/commands/server.rb:70:instart'
from /home/rank/.rvm/gems/ruby-2.0.0-p643/gems/railties-4.0.0/lib/rails/commands.rb:78:in block in <top (required)>'
from /home/rank/.rvm/gems/ruby-2.0.0-p643/gems/railties-4.0.0/lib/rails/commands.rb:73:intap'
from /home/rank/.rvm/gems/ruby-2.0.0-p643/gems/railties-4.0.0/lib/rails/commands.rb:73:in <top (required)>'
from bin/rails:4:inrequire'
from bin/rails:4:in `'
Looks like there's another copy of rails server running.
remove /home/rank/rails/chethan/specslot/tmp/pids and try to start server again. Looks like you had emergency shut down your machine recently

Rails Server fails to start on Ubuntu (was on MAC before), directly exiting

following my question here, I now set up a linux system trying to get it running. To repeat:
I have a website developed in RoR v 4.2.4 on a MAC OS X system
We need to adapt this website a bit and then deploy it on a server (the new linux system can be used later for the server)
This time I could update all the gems without a problem. bundle check says that all dependencies are satisfied. Unfortunately when i try to start the server to test the website with rails server the following error occours
Array values in the parameter to `Gem.paths=` are deprecated.
Please use a String or nil.
An Array ({"GEM_PATH"=>["/home/XWebsite/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0", "/home/XWebsite/.gem/ruby/2.4.0"]}) was passed in from bin/rails:3:in `load'
/home/XWebsite/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/thread_safe-0.3.5/lib/thread_safe/cache.rb:155: warning: constant ::Fixnum is deprecated
=> Booting Puma
=> Rails 4.2.4 application starting in development on http://localhost:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
/home/XWebsite/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/thread_safe-0.3.5/lib/thread_safe/cache.rb:155: warning: constant ::Fixnum is deprecated
/home/XWebsite/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-4.2.4/lib/active_support/core_ext/numeric/conversions.rb:121: warning: constant ::Fixnum is deprecated
/home/XWebsite/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-4.2.4/lib/active_support/core_ext/numeric/conversions.rb:121: warning: constant ::Bignum is deprecated
Exiting
/home/XWebsite/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-4.2.4/lib/active_support/core_ext/numeric/conversions.rb:124:in `block (2 levels) in <class:Numeric>': stack level too deep (SystemStackError)
from /home/XWebsite/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-4.2.4/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
from /home/XWebsite/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-4.2.4/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
from /home/XWebsite/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-4.2.4/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
from /home/XWebsite/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-4.2.4/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
from /home/XWebsite/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-4.2.4/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
from /home/XWebsite/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-4.2.4/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
from /home/XWebsite/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-4.2.4/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
from /home/XWebsite/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-4.2.4/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
... 4088 levels...
from /home/XWebsite/.rbenv/versions/2.4.0/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:68:in `require'
from /home/XWebsite/XWebsite/bin/spring:13:in `<top (required)>'
from bin/rails:3:in `load'
from bin/rails:3:in `<main>'
We also tried Webrick as the server but the error is the same with the exception of: 'Booting WEBrick'
Creating/Developping a new website with rails new blog and running the server works perfectly on the linux system.
Thanks a lot for your help in advance
bundle update spring
bundle exec spring binstub --remove --all
bundle exec spring binstub --all

active_support/secure_random LoadError

I am migrating my rails app from Rails 2.3 to 3.2. I have ActiveSupport 3.2 dependency but at app startup I keep getting following error. I am not using active_support/secure_random anywhere in my code. Can someone please help me solve this problem?
Error Logs -
[Thu Sep 04 22:52:56.014721 2014] [:warn] [pid 1440] FastCGI: server "AppRootFolder/bin/rails_dispatch.fcgi" (pid 1554) terminated by calling exit with status '1'
AppRootFolder/ruby1.9/gems/1.9.1/gems/activesupport-3.2.19/lib/active_support/dependencies.rb:317:in rescue in depend_on': No such file to load -- active_support/secure_random (LoadError) from AppRootFolder/ruby1.9/gems/1.9.1/gems/activesupport-3.2.19/lib/active_support/dependencies.rb:312:independ_on'
from AppRootFolder/ruby1.9/gems/1.9.1/gems/activesupport-3.2.19/lib/active_support/dependencies.rb:225:in require_dependency' from AppRootFolder/ruby1.9/gems/1.9.1/gems/railties-3.2.19/lib/rails/engine.rb:444:inblock (2 levels) in eager_load!'
from AppRootFolder/ruby1.9/gems/1.9.1/gems/railties-3.2.19/lib/rails/engine.rb:443:in each' from AppRootFolder/ruby1.9/gems/1.9.1/gems/railties-3.2.19/lib/rails/engine.rb:443:inblock in eager_load!'
from AppRootFolder/ruby1.9/gems/1.9.1/gems/railties-3.2.19/lib/rails/engine.rb:441:in each' from AppRootFolder/ruby1.9/gems/1.9.1/gems/railties-3.2.19/lib/rails/engine.rb:441:ineager_load!'
from AppRootFolder/ruby1.9/gems/1.9.1/gems/railties-3.2.19/lib/rails/application/finisher.rb:53:in block in <module:Finisher>' from AppRootFolder/ruby1.9/gems/1.9.1/gems/railties-3.2.19/lib/rails/initializable.rb:30:ininstance_exec'
from AppRootFolder/ruby1.9/gems/1.9.1/gems/railties-3.2.19/lib/rails/initializable.rb:30:in run' from AppRootFolder/ruby1.9/gems/1.9.1/gems/railties-3.2.19/lib/rails/initializable.rb:55:inblock in run_initializers'
from AppRootFolder/ruby1.9/gems/1.9.1/gems/railties-3.2.19/lib/rails/initializable.rb:54:in each' from AppRootFolder/ruby1.9/gems/1.9.1/gems/railties-3.2.19/lib/rails/initializable.rb:54:inrun_initializers'
from AppRootFolder/ruby1.9/gems/1.9.1/gems/railties-3.2.19/lib/rails/application.rb:136:in initialize!' from AppRootFolder/ruby1.9/gems/1.9.1/gems/railties-3.2.19/lib/rails/railtie/configurable.rb:30:inmethod_missing'
from AppRootFolder/var/rails-root/config/environment.rb:4:in <top (required)>' from AppRootFolder/ruby1.9/1.9.1/rubygems/custom_require.rb:36:inrequire'
from AppRootFolder/ruby1.9/1.9.1/rubygems/custom_require.rb:36:in require' from AppRootFolder/var/rails-root/config.ru:3:inblock in '
from AppRootFolder/ruby1.9/gems/1.9.1/gems/rack-1.4.5/lib/rack/builder.rb:51:in instance_eval' from AppRootFolder/ruby1.9/gems/1.9.1/gems/rack-1.4.5/lib/rack/builder.rb:51:ininitialize'
from AppRootFolder/var/rails-root/config.ru:in new' from AppRootFolder/var/rails-root/config.ru:in'
from AppRootFolder/ruby1.9/gems/1.9.1/gems/rack-1.4.5/lib/rack/builder.rb:40:in eval' from AppRootFolder/ruby1.9/gems/1.9.1/gems/rack-1.4.5/lib/rack/builder.rb:40:inparse_file'
from AppRootFolder/ruby1.9/gems/1.9.1/gems/rack-1.4.5/lib/rack/server.rb:200:in app' from AppRootFolder/ruby1.9/gems/1.9.1/gems/rack-1.4.5/lib/rack/server.rb:304:inwrapped_app'
from AppRootFolder/ruby1.9/gems/1.9.1/gems/rack-1.4.5/lib/rack/server.rb:254:in start' from AppRootFolder/ruby1.9/gems/1.9.1/gems/rack-1.4.5/lib/rack/server.rb:137:instart'
from AppRootFolder/bin/rails_dispatch.fcgi:20:in `'
ActiveSupport::SecureRandom was removed from rails 3.2 because rails 3.2 requires ruby 1.8.7 already has a builtin SecureRandom.
Replace any requires with
require 'securerandom'
And use SecureRandom instead.
If you're not using SecureRandom directly then you are probably using a gem that does, for example old versions of devise.

Resources