I updated from ruby 2.7.1 to 3.1.1, then removed Gemfile.lock and ran bundle update (it's on a dev branch, so I can throw it away if this is a bad idea, I just wanted to see if it would work).
bundle update succeeds, but when I start the server:
rails s
=> Booting Puma
=> Rails 7.0.2.2 application starting in development
=> Run `bin/rails server --help` for more startup options
Exiting
/Users/st/.rbenv/versions/3.1.1/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:430:in `visit_Psych_Nodes_Alias': Unknown alias: default (Psych::BadAlias)
from /Users/st/.rbenv/versions/3.1.1/lib/ruby/3.1.0/psych/visitors/visitor.rb:30:in `visit'
from /Users/st/.rbenv/versions/3.1.1/lib/ruby/3.1.0/psych/visitors/visitor.rb:6:in `accept'
from /Users/st/.rbenv/versions/3.1.1/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:35:in `accept'
from /Users/st/.rbenv/versions/3.1.1/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:345:in `block in revive_hash'
from /Users/st/.rbenv/versions/3.1.1/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:343:in `each'
from /Users/st/.rbenv/versions/3.1.1/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:343:in `each_slice'
from /Users/st/.rbenv/versions/3.1.1/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:343:in `revive_hash'
from /Users/st/.rbenv/versions/3.1.1/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:167:in `visit_Psych_Nodes_Mapping'
from /Users/st/.rbenv/versions/3.1.1/lib/ruby/3.1.0/psych/visitors/visitor.rb:30:in `visit'
from /Users/st/.rbenv/versions/3.1.1/lib/ruby/3.1.0/psych/visitors/visitor.rb:6:in `accept'
from /Users/st/.rbenv/versions/3.1.1/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:35:in `accept'
from /Users/st/.rbenv/versions/3.1.1/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:345:in `block in revive_hash'
from /Users/st/.rbenv/versions/3.1.1/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:343:in `each'
from /Users/st/.rbenv/versions/3.1.1/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:343:in `each_slice'
from /Users/st/.rbenv/versions/3.1.1/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:343:in `revive_hash'
from /Users/st/.rbenv/versions/3.1.1/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:167:in `visit_Psych_Nodes_Mapping'
from /Users/st/.rbenv/versions/3.1.1/lib/ruby/3.1.0/psych/visitors/visitor.rb:30:in `visit'
from /Users/st/.rbenv/versions/3.1.1/lib/ruby/3.1.0/psych/visitors/visitor.rb:6:in `accept'
from /Users/st/.rbenv/versions/3.1.1/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:35:in `accept'
from /Users/st/.rbenv/versions/3.1.1/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:318:in `visit_Psych_Nodes_Document'
from /Users/st/.rbenv/versions/3.1.1/lib/ruby/3.1.0/psych/visitors/visitor.rb:30:in `visit'
from /Users/st/.rbenv/versions/3.1.1/lib/ruby/3.1.0/psych/visitors/visitor.rb:6:in `accept'
from /Users/st/.rbenv/versions/3.1.1/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:35:in `accept'
from /Users/st/.rbenv/versions/3.1.1/lib/ruby/3.1.0/psych.rb:335:in `safe_load'
from /Users/st/.rbenv/versions/3.1.1/lib/ruby/3.1.0/psych.rb:370:in `load'
from /Users/st/.rbenv/versions/3.1.1/lib/ruby/gems/3.1.0/gems/webpacker-4.3.0/lib/webpacker/env.rb:30:in `available_environments'
from /Users/st/.rbenv/versions/3.1.1/lib/ruby/gems/3.1.0/gems/webpacker-4.3.0/lib/webpacker/env.rb:21:in `current'
from /Users/st/.rbenv/versions/3.1.1/lib/ruby/gems/3.1.0/gems/webpacker-4.3.0/lib/webpacker/env.rb:15:in `inquire'
from /Users/st/.rbenv/versions/3.1.1/lib/ruby/gems/3.1.0/gems/webpacker-4.3.0/lib/webpacker/env.rb:7:in `inquire'
from /Users/st/.rbenv/versions/3.1.1/lib/ruby/gems/3.1.0/gems/webpacker-4.3.0/lib/webpacker/instance.rb:11:in `env'
from /Users/st/.rbenv/versions/3.1.1/lib/ruby/gems/3.1.0/gems/webpacker-4.3.0/lib/webpacker/instance.rb:18:in `config'
from /Users/st/.rbenv/versions/3.1.1/lib/ruby/gems/3.1.0/gems/webpacker-4.3.0/lib/webpacker.rb:34:in `config'
from /Users/st/.rbenv/versions/3.1.1/lib/ruby/gems/3.1.0/gems/webpacker-4.3.0/lib/webpacker/railtie.rb:32:in `block in <class:Engine>'
from /Users/st/.rbenv/versions/3.1.1/lib/ruby/gems/3.1.0/gems/railties-7.0.2.2/lib/rails/initializable.rb:32:in `instance_exec'
from /Users/st/.rbenv/versions/3.1.1/lib/ruby/gems/3.1.0/gems/railties-7.0.2.2/lib/rails/initializable.rb:32:in `run'
from /Users/st/.rbenv/versions/3.1.1/lib/ruby/gems/3.1.0/gems/railties-7.0.2.2/lib/rails/initializable.rb:61:in `block in run_initializers'
from /Users/st/.rbenv/versions/3.1.1/lib/ruby/3.1.0/tsort.rb:228:in `block in tsort_each'
from /Users/st/.rbenv/versions/3.1.1/lib/ruby/3.1.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
from /Users/st/.rbenv/versions/3.1.1/lib/ruby/3.1.0/tsort.rb:431:in `each_strongly_connected_component_from'
from /Users/st/.rbenv/versions/3.1.1/lib/ruby/3.1.0/tsort.rb:349:in `block in each_strongly_connected_component'
from /Users/st/.rbenv/versions/3.1.1/lib/ruby/3.1.0/tsort.rb:347:in `each'
from /Users/st/.rbenv/versions/3.1.1/lib/ruby/3.1.0/tsort.rb:347:in `call'
from /Users/st/.rbenv/versions/3.1.1/lib/ruby/3.1.0/tsort.rb:347:in `each_strongly_connected_component'
from /Users/st/.rbenv/versions/3.1.1/lib/ruby/3.1.0/tsort.rb:226:in `tsort_each'
from /Users/st/.rbenv/versions/3.1.1/lib/ruby/3.1.0/tsort.rb:205:in `tsort_each'
from /Users/st/.rbenv/versions/3.1.1/lib/ruby/gems/3.1.0/gems/railties-7.0.2.2/lib/rails/initializable.rb:60:in `run_initializers'
from /Users/st/.rbenv/versions/3.1.1/lib/ruby/gems/3.1.0/gems/railties-7.0.2.2/lib/rails/application.rb:372:in `initialize!'
from /Users/st/rails/hangswith/config/environment.rb:5:in `<main>'
from /Users/st/.rbenv/versions/3.1.1/lib/ruby/gems/3.1.0/gems/bootsnap-1.10.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
from /Users/st/.rbenv/versions/3.1.1/lib/ruby/gems/3.1.0/gems/bootsnap-1.10.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
from /Users/st/.rbenv/versions/3.1.1/lib/ruby/gems/3.1.0/gems/zeitwerk-2.5.4/lib/zeitwerk/kernel.rb:35:in `require'
from /Users/st/.rbenv/versions/3.1.1/lib/ruby/gems/3.1.0/gems/bootsnap-1.10.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:42:in `require_relative'
from config.ru:3:in `block in <main>'
from /Users/st/.rbenv/versions/3.1.1/lib/ruby/gems/3.1.0/gems/rack-2.2.3/lib/rack/builder.rb:116:in `eval'
from /Users/st/.rbenv/versions/3.1.1/lib/ruby/gems/3.1.0/gems/rack-2.2.3/lib/rack/builder.rb:116:in `new_from_string'
from /Users/st/.rbenv/versions/3.1.1/lib/ruby/gems/3.1.0/gems/rack-2.2.3/lib/rack/builder.rb:105:in `load_file'
from /Users/st/.rbenv/versions/3.1.1/lib/ruby/gems/3.1.0/gems/rack-2.2.3/lib/rack/builder.rb:66:in `parse_file'
from /Users/st/.rbenv/versions/3.1.1/lib/ruby/gems/3.1.0/gems/rack-2.2.3/lib/rack/server.rb:349:in `build_app_and_options_from_config'
from /Users/st/.rbenv/versions/3.1.1/lib/ruby/gems/3.1.0/gems/rack-2.2.3/lib/rack/server.rb:249:in `app'
from /Users/st/.rbenv/versions/3.1.1/lib/ruby/gems/3.1.0/gems/rack-2.2.3/lib/rack/server.rb:422:in `wrapped_app'
from /Users/st/.rbenv/versions/3.1.1/lib/ruby/gems/3.1.0/gems/railties-7.0.2.2/lib/rails/commands/server/server_command.rb:76:in `log_to_stdout'
from /Users/st/.rbenv/versions/3.1.1/lib/ruby/gems/3.1.0/gems/railties-7.0.2.2/lib/rails/commands/server/server_command.rb:36:in `start'
from /Users/st/.rbenv/versions/3.1.1/lib/ruby/gems/3.1.0/gems/railties-7.0.2.2/lib/rails/commands/server/server_command.rb:143:in `block in perform'
from <internal:kernel>:90:in `tap'
from /Users/st/.rbenv/versions/3.1.1/lib/ruby/gems/3.1.0/gems/railties-7.0.2.2/lib/rails/commands/server/server_command.rb:134:in `perform'
from /Users/st/.rbenv/versions/3.1.1/lib/ruby/gems/3.1.0/gems/thor-1.2.1/lib/thor/command.rb:27:in `run'
from /Users/st/.rbenv/versions/3.1.1/lib/ruby/gems/3.1.0/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
from /Users/st/.rbenv/versions/3.1.1/lib/ruby/gems/3.1.0/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch'
from /Users/st/.rbenv/versions/3.1.1/lib/ruby/gems/3.1.0/gems/railties-7.0.2.2/lib/rails/command/base.rb:87:in `perform'
from /Users/st/.rbenv/versions/3.1.1/lib/ruby/gems/3.1.0/gems/railties-7.0.2.2/lib/rails/command.rb:48:in `invoke'
from /Users/st/.rbenv/versions/3.1.1/lib/ruby/gems/3.1.0/gems/railties-7.0.2.2/lib/rails/commands.rb:18:in `<main>'
from /Users/st/.rbenv/versions/3.1.1/lib/ruby/gems/3.1.0/gems/bootsnap-1.10.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
from /Users/st/.rbenv/versions/3.1.1/lib/ruby/gems/3.1.0/gems/bootsnap-1.10.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
from bin/rails:4:in `<main>'
What I've tried
Googling the 'psych' error message reveals this which may be related. But when I search the entire app for YAML.safe_load (or even just safe_load), there are 0 occurrences of it. (perhaps I should be searching actual gems in my app?).
It was a long shot but based on this comment, I ran gem rdoc --all to update all rdoc documentation. But that didn't help.
The problem is related to the Ruby 3.1 / Psych 4.x incompatibility described in this issue: https://bugs.ruby-lang.org/issues/17866
Ruby 3.0 comes with Psych 3, while Ruby 3.1 comes with Psych 4, which has a major breaking change (diff 3.3.2 → 4.0.0).
The new YAML loading methods (Psych 4) do not load aliases unless they get the aliases: true argument.
The old YAML loading methods (Psych 3) do not support the aliases keyword.
At this point, it seems like anyone, anywhere that wants to load YAML in the same way it worked prior to Ruby 3.1, need to do something like this:
begin
YAML.load(source, aliases: true, **options)
rescue ArgumentError
YAML.load(source, **options)
end
as patched by the Rails team.
In your case, I suspect you will need to see which Rails version that matches your major version preference includes this patch before you can upgrade to Ruby 3.1.
Personally, wherever I have control of the code that loads YAML, I am adding an extension like this:
module YAML
def self.properly_load_file(path)
YAML.load_file path, aliases: true
rescue ArgumentError
YAML.load_file path
end
end
or, if I want to completely revert this change done in Psych 4, I add this to my code:
module YAML
class << self
alias_method :load, :unsafe_load if YAML.respond_to? :unsafe_load
end
end
This has the advantage of restoring YAML::load, and YAML::load_file (which uses it) to their original glory, and solves everything including libraries that you have no control of, in all Ruby versions.
Lastly, as I mentioned in the comments, in case you prefer a minimally invasive stopgap measure, you might be able to get away with pinning Psych to < 4 in your Gemfile:
gem 'psych', '< 4'
Note for Rails users (>= 7.0.3.1)
ActiveRecord 7.0.3.1 changed an internal call and it now calls safe_load directly. If you see a Psych related error during rails tests, you might be affected by this change.
To resolve it, you can add this to a new or existing initializer:
# config/initializers/activerecord_yaml.rb
ActiveRecord.use_yaml_unsafe_load = true
You may also use ActiveRecord.yaml_column_permitted_classes to configure the allowed classes instead.
More info in this post.
I ran into the same problem, using a very recent version of rails and ruby 3.1.1 and the suggestion that DannyB mentioned fixed my problem.
In my Gemfile, I put webpacker3 and specified psych < 4. I don't know yet if this version of psych will break something down the road but at least webpacker installed:
gem 'webpacker', '~>3.0'
gem 'psych', '< 4'
In my case I had ruby version 3.0.3 on gem 'rails', '~> 6.1.5'
My default system version was locked to psych (default: 3.3.2) but somehow Gemfile.lock had stuff broken with:
psych (4.0.3)
stringio
sdoc (2.3.1)
rdoc (>= 5.0, < 6.4.0)
The solution was to remove those, then lock correct version of Psych in Gemfile
gem 'psych', '< 4
Then bundle install which fixed the circular broken dependencies
A simple solution: downgrade to ruby 3.0.X
This is simple and easy, requires no code changes, and can be upgraded to ruby 3.1.x in the near future when everything's caught up and is compatible with Psych 4.
Note: ruby 3.0.3 is the latest ruby version which still uses Psych 3.x.x, so there are no problems and everything just works.
Why this solution?
I prefer this option because patching an app or its gems can get complicated and I prefer the simplest/safest solution.
See here and here for the advice that helped me make the decision:
I think it's best to revert to ruby 3.0.3, so as to use the latest ruby version that doesn't use psych 4. Do you think that's a good idea?
Absolutely yes in regards to reverting to Ruby < 3.1 ... it takes time until the gem developers community will update their gems
Why not downgrade psych instead?
The only reason I didn't downgrade psych gem instead of ruby is because I'm not 100% sure that doing so won't cause problems elsewhere, potentially things that are hard to detect. Although it could be a completely viable solution (I'm just not sure that it is, hence I prefer to play it safe and downgrade ruby instead).
in my case, after update to ruby 3.1.2 updating to rails 7.0.4 solved it.
Related
CentOS-6.6
ruby 2.2.0p0 (2014-12-25 revision 49005) [x86_64-linux-gnu]
Bundler version 1.7.11
I am attempting to patch a older RoR application that was upgraded to 4.0.1 last year. When I run bundle exec cucumber before making any changes I now get this sort of error:
bundle exec cucumber
/home/byrnejb/Projects/Software/theHeart/code/hll_th_forex_rss/libexec/bundler/lib/ruby/2.2.0/gems/activesupport-4.0.1/lib/active_support/values/time_zone.rb:282: warning: circular argument reference - now
cannot load such file -- test/unit/assertions (LoadError)
/home/byrnejb/Projects/Software/theHeart/code/hll_th_forex_rss/libexec/bundler/lib/ruby/2.2.0/gems/activesupport-4.0.1/lib/active_support/dependencies.rb:229:in `require'
/home/byrnejb/Projects/Software/theHeart/code/hll_th_forex_rss/libexec/bundler/lib/ruby/2.2.0/gems/activesupport-4.0.1/lib/active_support/dependencies.rb:229:in `block in require'
/home/byrnejb/Projects/Software/theHeart/code/hll_th_forex_rss/libexec/bundler/lib/ruby/2.2.0/gems/activesupport-4.0.1/lib/active_support/dependencies.rb:214:in `load_dependency'
/home/byrnejb/Projects/Software/theHeart/code/hll_th_forex_rss/libexec/bundler/lib/ruby/2.2.0/gems/activesupport-4.0.1/lib/active_support/dependencies.rb:229:in `require'
/home/byrnejb/Projects/Software/theHeart/code/hll_th_forex_rss/features/support/local_env.rb:5:in `<top (required)>'
/home/byrnejb/Projects/Software/theHeart/code/hll_th_forex_rss/libexec/bundler/lib/ruby/2.2.0/gems/activesupport-4.0.1/lib/active_support/dependencies.rb:223:in `load'
/home/byrnejb/Projects/Software/theHeart/code/hll_th_forex_rss/libexec/bundler/lib/ruby/2.2.0/gems/activesupport-4.0.1/lib/active_support/dependencies.rb:223:in `block in load'
/home/byrnejb/Projects/Software/theHeart/code/hll_th_forex_rss/libexec/bundler/lib/ruby/2.2.0/gems/activesupport-4.0.1/lib/active_support/dependencies.rb:214:in `load_dependency'
/home/byrnejb/Projects/Software/theHeart/code/hll_th_forex_rss/libexec/bundler/lib/ruby/2.2.0/gems/activesupport-4.0.1/lib/active_support/dependencies.rb:223:in `load'
/home/byrnejb/Projects/Software/theHeart/code/hll_th_forex_rss/libexec/bundler/lib/ruby/2.2.0/gems/cucumber-1.3.19/lib/cucumber/rb_support/rb_language.rb:95:in `load_code_file'
/home/byrnejb/Projects/Software/theHeart/code/hll_th_forex_rss/libexec/bundler/lib/ruby/2.2.0/gems/cucumber-1.3.19/lib/cucumber/runtime/support_code.rb:180:in `load_file'
/home/byrnejb/Projects/Software/theHeart/code/hll_th_forex_rss/libexec/bundler/lib/ruby/2.2.0/gems/cucumber-1.3.19/lib/cucumber/runtime/support_code.rb:83:in `block in load_files!'
/home/byrnejb/Projects/Software/theHeart/code/hll_th_forex_rss/libexec/bundler/lib/ruby/2.2.0/gems/cucumber-1.3.19/lib/cucumber/runtime/support_code.rb:82:in `each'
/home/byrnejb/Projects/Software/theHeart/code/hll_th_forex_rss/libexec/bundler/lib/ruby/2.2.0/gems/cucumber-1.3.19/lib/cucumber/runtime/support_code.rb:82:in `load_files!'
/home/byrnejb/Projects/Software/theHeart/code/hll_th_forex_rss/libexec/bundler/lib/ruby/2.2.0/gems/cucumber-1.3.19/lib/cucumber/runtime.rb:184:in `load_step_definitions'
/home/byrnejb/Projects/Software/theHeart/code/hll_th_forex_rss/libexec/bundler/lib/ruby/2.2.0/gems/cucumber-1.3.19/lib/cucumber/runtime.rb:42:in `run!'
/home/byrnejb/Projects/Software/theHeart/code/hll_th_forex_rss/libexec/bundler/lib/ruby/2.2.0/gems/cucumber-1.3.19/lib/cucumber/cli/main.rb:47:in `execute!'
/home/byrnejb/Projects/Software/theHeart/code/hll_th_forex_rss/libexec/bundler/lib/ruby/2.2.0/gems/cucumber-1.3.19/bin/cucumber:13:in `<top (required)>'
/home/byrnejb/Projects/Software/theHeart/code/hll_th_forex_rss/libexec/bundler/lib/ruby/2.2.0/bin/cucumber:23:in `load'
/home/byrnejb/Projects/Software/theHeart/code/hll_th_forex_rss/libexec/bundler/lib/ruby/2.2.0/bin/cucumber:23:in `<main>'
warning: circular argument reference - xxxx was limited to Cucumber, which formerly was at 1.3.10. So I updated cucumber to 1.3.19. Now I am getting the error in active support. Has anyone else seen this.
I had a problem with Minitest preventing this project from advancing to RoR-4.1 back last spring. I do not know if this is pertinent or not but I include it for completeness.
In any case, who puts testing dependencies into distributed runtime code? Why is activesupport complaining about 'test/unit/assertions'?
Try upgrading from Rails 4.0.1 to 4.0.13
If that doesn't work, try using Ruby 2.1.5 to see if you get the same error message. I bet some gem you're using is running into this issue with Ruby 2.2. Example 1, Example 2. Example 3 from Rails.
The long term solution is to use Ruby 2.2 compatible gems, but by switching to 2.1.5 temporarily, you may be able to solve the problem in the short term and narrow down the specific gem versions that are causing the error.
i just add gem 'test-unit' in Gemfile and run 'bundle install' again. It is solved to me.
I'm currently trying to get a Mongo database running alongside Devise. I'm using Rails 3.2.2 and Ruby 1.9.3, mongo_mapper 0.11.0, devise 1.1.9, and devise-mongo_mapper 0.0.2. I've referred to numerous sources online, but they seem to be invariably outdated.
A huge problem I'm facing right now involves devise-mongo_mapper. With mongod running on the terminal, trying to run the rails server gives me the following:
/usr/local/lib/ruby/gems/1.9.1/gems/devise-1.1.9/lib/devise.rb:193:in `mailer=': undefined method `ref' for ActiveSupport::Dependencies:Module (NoMethodError)
from /usr/local/lib/ruby/gems/1.9.1/gems/devise-1.1.9/lib/devise.rb:195:in `<module:Devise>'
from /usr/local/lib/ruby/gems/1.9.1/gems/devise-1.1.9/lib/devise.rb:4:in `<top (required)>'
from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.21/lib/bundler/runtime.rb:68:in `require'
from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.21/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.21/lib/bundler/runtime.rb:66:in `each'
from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.21/lib/bundler/runtime.rb:66:in `block in require'
from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.21/lib/bundler/runtime.rb:55:in `each'
from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.21/lib/bundler/runtime.rb:55:in `require'
from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.21/lib/bundler.rb:122:in `require'
from /home/neilbasu/Desktop/rails_practice_app/onemoremongopractice/config/application.rb:13:in `<top (required)>'
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.2.2/lib/rails/commands.rb:53:in `require'
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.2.2/lib/rails/commands.rb:53:in `block in <top (required)>'
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.2.2/lib/rails/commands.rb:50:in `tap'
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.2.2/lib/rails/commands.rb:50:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
I checked online and found this could be because my devise isn't updated. Trying to update it gave me this:
Bundler could not find compatible versions for gem "devise":
In Gemfile:
devise-mongo_mapper (>= 0) ruby depends on
devise (~> 1.1.0) ruby
devise (2.0.4)
So basically, the older devise won't work, and the newest version isn't compatible with my current devise-mongo_mapper. Is there any way around this? Either a way to get all of these programs working together or a way to not need devise-mongo_mapper at all would be great.
Take a look at several of the forks.
They just bumped the version in the gemspec and the code probably works unchanged.
You can install whatever version of the gem you want using the -v argument.
sudo gem install whatever -v 1.0.1
Or you can look at the forks as Plastic Chicken suggested.
I was also facing the same error and running "bundle update" solved my problem.
I'm trying to use warbler on ChiliProject (a Redmine fork, Rails 2.3 app) to deploy it in a Java Jetty web server. But when I run warble at the projects root folder, it fails with the given error message:
$ warble --trace
warble aborted!
undefined method `gems' for #<Rails::VendorGemSourceIndex:0x2e9267fe>
/Users/razenha/.rvm/gems/jruby-1.6.3/gems/bundler-1.0.15/lib/bundler/rubygems_integration.rb:260:in `all_specs'
/Users/razenha/.rvm/gems/jruby-1.6.3/gems/bundler-1.0.15/lib/bundler/source.rb:172:in `installed_specs'
/Users/razenha/.rvm/gems/jruby-1.6.3/gems/bundler-1.0.15/lib/bundler/source.rb:162:in `fetch_specs'
/Users/razenha/.rvm/gems/jruby-1.6.3/gems/bundler-1.0.15/lib/bundler/index.rb:7:in `build'
/Users/razenha/.rvm/gems/jruby-1.6.3/gems/bundler-1.0.15/lib/bundler/source.rb:161:in `fetch_specs'
/Users/razenha/.rvm/gems/jruby-1.6.3/gems/bundler-1.0.15/lib/bundler/source.rb:70:in `specs'
/Users/razenha/.rvm/gems/jruby-1.6.3/gems/bundler-1.0.15/lib/bundler/definition.rb:159:in `index'
org/jruby/RubyArray.java:1603:in `each'
/Users/razenha/.rvm/gems/jruby-1.6.3/gems/bundler-1.0.15/lib/bundler/definition.rb:158:in `index'
/Users/razenha/.rvm/gems/jruby-1.6.3/gems/bundler-1.0.15/lib/bundler/index.rb:7:in `build'
/Users/razenha/.rvm/gems/jruby-1.6.3/gems/bundler-1.0.15/lib/bundler/definition.rb:157:in `index'
/Users/razenha/.rvm/gems/jruby-1.6.3/gems/bundler-1.0.15/lib/bundler/definition.rb:151:in `resolve'
/Users/razenha/.rvm/gems/jruby-1.6.3/gems/bundler-1.0.15/lib/bundler/definition.rb:90:in `specs'
/Users/razenha/.rvm/gems/jruby-1.6.3/gems/bundler-1.0.15/lib/bundler/definition.rb:135:in `specs_for'
/Users/razenha/.rvm/gems/jruby-1.6.3/gems/bundler-1.0.15/lib/bundler/definition.rb:124:in `requested_specs'
/Users/razenha/.rvm/gems/jruby-1.6.3/gems/warbler-1.3.2/lib/warbler/traits/bundler.rb:102:in `bundler_specs'
/Users/razenha/.rvm/gems/jruby-1.6.3/gems/warbler-1.3.2/lib/warbler/traits/bundler.rb:38:in `add_bundler_gems'
/Users/razenha/.rvm/gems/jruby-1.6.3/gems/warbler-1.3.2/lib/warbler/traits/bundler.rb:29:in `after_configure'
/Users/razenha/.rvm/gems/jruby-1.6.3/gems/warbler-1.3.2/lib/warbler/traits.rb:32:in `after_configure'
org/jruby/RubyArray.java:1603:in `each'
/Users/razenha/.rvm/gems/jruby-1.6.3/gems/warbler-1.3.2/lib/warbler/traits.rb:32:in `after_configure'
/Users/razenha/.rvm/gems/jruby-1.6.3/gems/warbler-1.3.2/lib/warbler/config.rb:172:in `initialize'
/Users/razenha/.rvm/gems/jruby-1.6.3/gems/warbler-1.3.2/lib/warbler/task.rb:48:in `initialize'
/Users/razenha/.rvm/gems/jruby-1.6.3/gems/warbler-1.3.2/lib/warbler/application.rb:27:in `load_rakefile'
/Users/razenha/.rvm/gems/jruby-1.6.3/gems/rake-0.9.2/lib/rake/application.rb:61:in `run'
/Users/razenha/.rvm/gems/jruby-1.6.3/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling'
/Users/razenha/.rvm/gems/jruby-1.6.3/gems/rake-0.9.2/lib/rake/application.rb:59:in `run'
/Users/razenha/.rvm/gems/jruby-1.6.3/gems/warbler-1.3.2/lib/warbler/application.rb:70:in `run'
/Users/razenha/.rvm/gems/jruby-1.6.3/gems/warbler-1.3.2/bin/warble:11:in `(root)'
org/jruby/RubyKernel.java:1063:in `load'
/Users/razenha/.rvm/gems/jruby-1.6.3/bin/warble:19:in `(root)'
I'm using JRuby 1.6.3, JDK 1.6, warbler 1.3.2 and ChiliProject 2.2.0.
At first, I sadly have to disappoint you, as we don't fully support JRuby yet. On the other hand, there are probably "only" encoding issues left to fix so if you are careful, things should work out just okay.
That said, it looks like Rails 2.3 doesn't play too well with Bundler here. If you drop the following file into lib/redmine/core_ext/vendor_gem_source_index.rb of your ChiliProject dirctory, you should be able to run warbler.
class Rails::VendorGemSourceIndex
def gems
#installed_source_index.gems.merge #vendor_source_index.gems
end
end
You still need to configure warbler to use the correct bundler groups. As warbler does it's own thing here (and as I haven't yet used warbler with bundled apps) you might need top find out how to configure this. Have a look into the Gemfile and our Bundler page for more information.
And if you are nagging enough, we might one day officially support this :) Also, more friendly people can be found in our own Forums and on IRC.
I Am using exception notifier like this in my rails 3.0.7-
gem 'exception_notification_rails3', :require => 'exception_notifier'
This application uses mongoid rather than ActiveRecord. But when I try to open rails c, it give following error -
Could not load SystemTimer >= v1.2.0. Falling back to timeout.rb. SystemTimer is STRONGLY recommended for timeouts in Ruby 1.8.7. See http://ph7spot.com/blog/system-timer-1-2-release for details.
/var/lib/gems/1.8/gems/exception_notification_rails3-1.2.0/lib/exception_notifier.rb:8:in `default_ignore_exceptions': uninitialized constant ActiveRecord::RecordNotFound (NameError)
from /var/lib/gems/1.8/gems/exception_notification_rails3-1.2.0/lib/exception_notifier.rb:7:in `tap'
from /var/lib/gems/1.8/gems/exception_notification_rails3-1.2.0/lib/exception_notifier.rb:7:in `default_ignore_exceptions'
from /var/lib/gems/1.8/gems/exception_notification_rails3-1.2.0/lib/exception_notifier.rb:30:in `initialize'
from /var/lib/gems/1.8/gems/actionpack-3.0.7/lib/action_dispatch/middleware/stack.rb:33:in `new'
from /var/lib/gems/1.8/gems/actionpack-3.0.7/lib/action_dispatch/middleware/stack.rb:33:in `build'
from /var/lib/gems/1.8/gems/actionpack-3.0.7/lib/action_dispatch/middleware/stack.rb:79:in `build'
from /var/lib/gems/1.8/gems/railties-3.0.7/lib/rails/application.rb:209:in `inject'
from /var/lib/gems/1.8/gems/actionpack-3.0.7/lib/action_dispatch/middleware/stack.rb:79:in `each'
from /var/lib/gems/1.8/gems/actionpack-3.0.7/lib/action_dispatch/middleware/stack.rb:79:in `inject'
from /var/lib/gems/1.8/gems/actionpack-3.0.7/lib/action_dispatch/middleware/stack.rb:79:in `build'
from /var/lib/gems/1.8/gems/railties-3.0.7/lib/rails/application.rb:162:in `build_middleware_stack'
from /var/lib/gems/1.8/gems/railties-3.0.7/lib/rails/application/finisher.rb:35
from /var/lib/gems/1.8/gems/railties-3.0.7/lib/rails/initializable.rb:25:in `instance_exec'
from /var/lib/gems/1.8/gems/railties-3.0.7/lib/rails/initializable.rb:25:in `run'
from /var/lib/gems/1.8/gems/railties-3.0.7/lib/rails/initializable.rb:50:in `run_initializers'
from /var/lib/gems/1.8/gems/railties-3.0.7/lib/rails/initializable.rb:49:in `each'
from /var/lib/gems/1.8/gems/railties-3.0.7/lib/rails/initializable.rb:49:in `run_initializers'
from /var/lib/gems/1.8/gems/railties-3.0.7/lib/rails/application.rb:134:in `initialize!'
from /var/lib/gems/1.8/gems/railties-3.0.7/lib/rails/application.rb:77:in `send'
from /var/lib/gems/1.8/gems/railties-3.0.7/lib/rails/application.rb:77:in `method_missing'
from /home/rtdp/workspace/bids/config/environment.rb:5
from /var/lib/gems/1.8/gems/railties-3.0.7/lib/rails/application.rb:103:in `require_environment!'
from /var/lib/gems/1.8/gems/railties-3.0.7/lib/rails/commands.rb:22
from script/rails:6:in `require'
from script/rails:6
I tried googling over this, but couldn't find anything related.
Thanks.
UPDATE -
I just checked in /var/lib/gems/1.8/gems/exception_notification_rails3-1.2.0/lib/exception_notifier.rb file. This file has code -
exceptions << ActiveRecord::RecordNotFound if defined? ActiveRecord
So commented this, and checked. Now the system works. So this means my active record is being declared somewhere. I reconfirmed this on console.
My application.rb file has this -
require "action_controller/railtie"
require "action_mailer/railtie"
require "active_resource/railtie"
require "rails/test_unit/railtie"
Now, what might be causing to include the ActiveRecord and then failing the Exception Notifier ?
People, http://github.com/rails/exception_notification is no longer the official exception_notification repo. See the note on the home page.
The official repo lies now on http://github.com/smartinez87/exception_notification
If you do gem install exception_notification it will pull the gem from there.
This issue is already fixed there, if not please report the issue there.
Thanks!
I found that some other gem was including the ActiveRecord as a dependency, and that was causing this to fail. I removed that gem and everything is fine now.
Erik Hollensbe fixed this error in his personal fork of exception_notifier. His solution worked perfectly for me under Rails 3.0.9 and Ruby 1.9.2p180.
I'm trying to teach myself rails by going through http://railstutorial.org/. I quit working on the tutorial app last night and then came back to it today. Now I'm getting an error when I start up the Spork server. Here is a trace of the error.
spork Using RSpec Loading Spork.prefork block... can't convert nil into Hash (TypeError) /usr/local/lib/ruby/gems/1.8/gems/activemodel-3.0.0/lib/active_model/validations/validates.rb:90:in merge' /usr/local/lib/ruby/gems/1.8/gems/activemodel-3.0.0/lib/active_model/validations/validates.rb:90:invalidates' /usr/local/lib/ruby/gems/1.8/gems/activemodel-3.0.0/lib/active_model/validations/validates.rb:83:in each' /usr/local/lib/ruby/gems/1.8/gems/activemodel-3.0.0/lib/active_model/validations/validates.rb:83:invalidates' /Users/chietala/Desktop/rails_projects/sample_app/app/models/user.rb:20 /usr/local/lib/ruby/gems/1.8/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:454:in load' /usr/local/lib/ruby/gems/1.8/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:454:inload_file' /usr/local/lib/ruby/gems/1.8/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:591:in new_constants_in' /usr/local/lib/ruby/gems/1.8/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:453:inload_file' /usr/local/lib/ruby/gems/1.8/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:340:in require_or_load' /usr/local/lib/ruby/gems/1.8/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:300:independ_on' /usr/local/lib/ruby/gems/1.8/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:216:in require_dependency' /usr/local/lib/ruby/gems/1.8/gems/railties-3.0.0/lib/rails/engine.rb:138:ineager_load!' /usr/local/lib/ruby/gems/1.8/gems/railties-3.0.0/lib/rails/engine.rb:137:in each' /usr/local/lib/ruby/gems/1.8/gems/railties-3.0.0/lib/rails/engine.rb:137:ineager_load!' /usr/local/lib/ruby/gems/1.8/gems/railties-3.0.0/lib/rails/engine.rb:135:in each' /usr/local/lib/ruby/gems/1.8/gems/railties-3.0.0/lib/rails/engine.rb:135:ineager_load!' /usr/local/lib/ruby/gems/1.8/gems/railties-3.0.0/lib/rails/application.rb:108:in eager_load!' /usr/local/lib/ruby/gems/1.8/gems/railties-3.0.0/lib/rails/application/finisher.rb:41 /usr/local/lib/ruby/gems/1.8/gems/railties-3.0.0/lib/rails/initializable.rb:25:ininstance_exec' /usr/local/lib/ruby/gems/1.8/gems/railties-3.0.0/lib/rails/initializable.rb:25:in run' /usr/local/lib/ruby/gems/1.8/gems/railties-3.0.0/lib/rails/initializable.rb:50:inrun_initializers' /usr/local/lib/ruby/gems/1.8/gems/railties-3.0.0/lib/rails/initializable.rb:49:in each' /usr/local/lib/ruby/gems/1.8/gems/railties-3.0.0/lib/rails/initializable.rb:49:inrun_initializers' /usr/local/lib/ruby/gems/1.8/gems/railties-3.0.0/lib/rails/application.rb:134:in initialize!' /usr/local/lib/ruby/gems/1.8/gems/railties-3.0.0/lib/rails/application.rb:77:insend' /usr/local/lib/ruby/gems/1.8/gems/railties-3.0.0/lib/rails/application.rb:77:in method_missing' /Users/chietala/Desktop/rails_projects/sample_app/spec/../config/environment.rb:5 /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:ingem_original_require' /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in require' /Users/chietala/Desktop/rails_projects/sample_app/spec/spec_helper.rb:10 /usr/local/lib/ruby/gems/1.8/gems/spork-0.8.4/bin/../lib/spork.rb:23:inprefork' /Users/chietala/Desktop/rails_projects/sample_app/spec/spec_helper.rb:4 /usr/local/lib/ruby/gems/1.8/gems/spork-0.8.4/lib/spork/test_framework.rb:138:in load' /usr/local/lib/ruby/gems/1.8/gems/spork-0.8.4/lib/spork/test_framework.rb:138:inpreload' /usr/local/lib/ruby/gems/1.8/gems/spork-0.8.4/lib/spork/app_framework.rb:64:in preload' /usr/local/lib/ruby/gems/1.8/gems/spork-0.8.4/lib/spork/test_framework.rb:134:inpreload' /usr/local/lib/ruby/gems/1.8/gems/spork-0.8.4/bin/../lib/spork.rb:67:in exec_prefork' /usr/local/lib/ruby/gems/1.8/gems/spork-0.8.4/lib/spork/test_framework.rb:120:inpreload' /usr/local/lib/ruby/gems/1.8/gems/spork-0.8.4/lib/spork/run_strategy/forking.rb:25:in preload' /usr/local/lib/ruby/gems/1.8/gems/spork-0.8.4/bin/../lib/spork/runner.rb:74:inrun' /usr/local/lib/ruby/gems/1.8/gems/spork-0.8.4/bin/../lib/spork/runner.rb:9:in run' /usr/local/lib/ruby/gems/1.8/gems/spork-0.8.4/bin/spork:10 /usr/local/bin/spork:19:inload' /usr/local/bin/spork:19
Luckily I am using Git for version control and I was in a separate branch when I received this problem, however switching to the master still results in the error.
I'm not really sure where or how to fix this problem. Anyone have any ideas?
I was using 1.9.2, rails3, and rspec-rails 2.0.0rc with spork-0.8.4 successfully. Then I upgraded to rspec-rails 2.0.0 and had some issues.
I just upgraded my Gemfile to rspec-rails 2.0.1 and spork 0.9.0.rc2 and everything works again!
Gemfile:
gem 'rspec-rails','>= 2.0.1'
gem 'spork', '>= 0.9.0.rc2'
Give that a shot. (You can always switch back to your old version, if it doesn't help.)
Check the spork page on github to see if there are any other things to consider. If you are using 1.8.7 there may be some differences.
If you want the cutting edge (sometimes I do on gems):
gem 'spork', :git => 'http://github.com/timcharper/spork.git'
Maybe there is a fix for your particular combo....
Let me know if this helps!