0

I'm learning sinatra and I get the following error

Boot Error

Something went wrong while loading recall.rb
NoMethodError: undefined method `<<' for nil:NilClass

/Users/nikhil/.rvm/gems/ruby-1.9.3-p194/gems/rack-flash-0.1.2/lib/rack/flash.rb:11:in `use'
/Users/nikhil/.rvm/gems/ruby-1.9.3-p194/gems/shotgun-0.9/bin/shotgun:128:in `block (2 levels) in <top (required)>'
/Users/nikhil/.rvm/gems/ruby-1.9.3-p194/gems/shotgun-0.9/lib/shotgun/loader.rb:104:in `instance_eval'
/Users/nikhil/.rvm/gems/ruby-1.9.3-p194/gems/shotgun-0.9/lib/shotgun/loader.rb:104:in `block in assemble_app'
/Users/nikhil/.rvm/gems/ruby-1.9.3-p194/gems/rack-1.4.1/lib/rack/builder.rb:51:in `instance_eval'
/Users/nikhil/.rvm/gems/ruby-1.9.3-p194/gems/rack-1.4.1/lib/rack/builder.rb:51:in `initialize'
/Users/nikhil/.rvm/gems/ruby-1.9.3-p194/gems/shotgun-0.9/lib/shotgun/loader.rb:103:in `new'
/Users/nikhil/.rvm/gems/ruby-1.9.3-p194/gems/shotgun-0.9/lib/shotgun/loader.rb:103:in `assemble_app'
/Users/nikhil/.rvm/gems/ruby-1.9.3-p194/gems/shotgun-0.9/lib/shotgun/loader.rb:86:in `proceed_as_child'
/Users/nikhil/.rvm/gems/ruby-1.9.3-p194/gems/shotgun-0.9/lib/shotgun/loader.rb:31:in `call!'
/Users/nikhil/.rvm/gems/ruby-1.9.3-p194/gems/shotgun-0.9/lib/shotgun/loader.rb:18:in `call'
/Users/nikhil/.rvm/gems/ruby-1.9.3-p194/gems/shotgun-0.9/lib/shotgun/favicon.rb:12:in `call'
/Users/nikhil/.rvm/gems/ruby-1.9.3-p194/gems/shotgun-0.9/lib/shotgun/static.rb:14:in `call'
/Users/nikhil/.rvm/gems/ruby-1.9.3-p194/gems/rack-1.4.1/lib/rack/builder.rb:134:in `call'
/Users/nikhil/.rvm/gems/ruby-1.9.3-p194/gems/rack-1.4.1/lib/rack/handler/webrick.rb:59:in `service'
/Users/nikhil/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/webrick/httpserver.rb:138:in `service'
/Users/nikhil/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/webrick/httpserver.rb:94:in `run'
/Users/nikhil/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/webrick/server.rb:191:in `block in start_thread'

I'm not able to decipher it as id doesn't point to any of my source files.

The error arose when I followed this part of a tutorial where they talk about notices and error messages. The main file for my app includes the following gems.

require "sinatra"
require "data_mapper"
require "rack-flash"
require "sinatra/redirect_with_flash"
4

1 回答 1

2

You're using an old version of rack-flash that doesn't work with the version of rack you're using. The line throwing the error is inside rack-flash itself where its trying to mutate some Rack internal state that has since changed.

For some reason the latest version of that gem is called rack-flash3 which is why install rack-flash still gets you the old version of the gem.

于 2012-07-08T19:58:06.617 回答