开发者

script/console won't work; reports "Missing the Rails gem. Please `gem install -v= rails`..." even though rails shows as installed

I'm trying to learn RoR, and running script/console fails, returning:

Loading development environment (Rails 2.3.5) Missing the Rails gem. Please gem install -v= rails, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version installed.

Both gem list and sudo gem list show rails (2.3.5) as installed. Additionally, script/server works fine. I found some sources that suggested the problem might be with rack (1.1.0), so I reverted back to 1.0.1, but it didn't help.

I'd love any suggestions you guys have, because I really want to learn RoR after even the brief bits I've seen so far.

EDIT: @zed_0xff:

All right, here's the result of ./script/console --trace:

/usr/lib/ruby/1.8/optparse.rb:1450:in `complete': invalid option: --trace (OptionParser::InvalidOption)
    from /usr/lib/rub开发者_开发百科y/1.8/optparse.rb:1448:in `catch'
    from /usr/lib/ruby/1.8/optparse.rb:1448:in `complete'
    from /usr/lib/ruby/1.8/optparse.rb:1261:in `parse_in_order'
    from /usr/lib/ruby/1.8/optparse.rb:1254:in `catch'
    from /usr/lib/ruby/1.8/optparse.rb:1254:in `parse_in_order'
    from /usr/lib/ruby/1.8/optparse.rb:1248:in `order!'
    from /usr/lib/ruby/1.8/optparse.rb:1339:in `permute!'
    from /usr/lib/ruby/1.8/optparse.rb:1360:in `parse!'
    from /var/lib/gems/1.8/gems/rails-2.3.5/lib/commands/console.rb:11
    from /usr/lib/ruby/1.8/optparse.rb:791:in `initialize'
    from /var/lib/gems/1.8/gems/rails-2.3.5/lib/commands/console.rb:6:in `new'
    from /var/lib/gems/1.8/gems/rails-2.3.5/lib/commands/console.rb:6
    from /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
    from /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `require'
    from ./script/console:3

And here's the result of rake db:migrate --trace:

(in /home/carpdiem/Dropbox/programming/ruby/rails_projects/demo_app)
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:migrate
** Invoke db:schema:dump (first_time)
** Invoke environment 
** Execute db:schema:dump

Does that help?

EDIT #2: @zed_0xff:

rake gems:

`(in /home/carpdiem/Dropbox/programming/ruby/rails_projects/demo_app)

I = Installed F = Frozen R = Framework (loaded before rails starts)`

config/environment.rb:

`require File.join(File.dirname(File), 'boot')

Rails::Initializer.run do |config| config.time_zone = 'UTC' end`

EDIT #3: I fixed it! It sounds like there was some complicated dependency issues at fault. Following the suggestion from here: http://docs.heroku.com/rails236 to upgrade to rails 2.3.8 seems to have resolved the problem. script/console starts up correctly now.


try to run ./script/console --trace or rake db:migrate --trace, rake command will likely fail too, but --trace switch can provide you a valuable information where your app fails.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜