脚本/控制台不起作用;报道“缺少Rails宝石。请`gem install -v = rails` ..."即使轨道显示为已安装 [英] script/console won't work; reports "Missing the Rails gem. Please `gem install -v= rails`..." even though rails shows as installed

查看:120
本文介绍了脚本/控制台不起作用;报道“缺少Rails宝石。请`gem install -v = rails` ..."即使轨道显示为已安装的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



正在加载开发环境(Rails 2.3.5)
缺少对应的脚本/控制台失败Rails宝石。请 gem install -v = rails ,在config / environment.rb中更新您安装的Rails版本的RAILS_GEM_VERSION设置,或者注释掉RAILS_GEM_VERSION以使用安装的最新版本。



gem list 和 sudo gem list show导轨(2.3.5)安装。另外,脚本/服务器工作正常。我发现一些消息来源表示这个问题可能与rack(1.1.0)有关,所以我恢复到了1.0.1,但它没有帮助。



I 'd爱你们有的任何建议,因为我甚至想在我看到迄今为止的简短内容之后学习RoR。



编辑:@ zed_0xff:



好的,这是 ./ script / console --trace 的结果:

  /usr/lib/ruby/1.8/optparse.rb:1450:in`complete':无效选项:--trace(OptionParser :: InvalidOption)$ b $ from /usr/lib/ruby/1.8/optparse.rb:1448:in`catch'$ b $ 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:在`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:从/usr/lib/ruby/1.8/optparse.rb:791获得11
:从/var/lib/gems/1.8/gems/rails-2.3.5/lib/commands初始化
在/ usr / lib / ruby​​ / 1.8 / ruby​​gems / custom_require.rb:31:在`gem_original_require'
/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in`require'
from。 / script / console:3

以下是 rake db:migrate的结果--trace

 (在/ home / carpdiem / Dropbox / programming / ruby​​ / rails_projects / demo_app)
**调用db:migrate(first_time)
**调用环境(first_time)
**执行环境
**执行db:migrate
**调用db:schema:dump(first_time)
**调用环境
**执行db:schema:dump

这有帮助吗?



编辑#2:@ zed_0xff:



rake gems



在/ home / carpdiem / Dropbox / programming / ruby​​ / rails_projects / demo_app)
$ b $ I =已安装
F =已冻结
R =框架(在rails开始之前加载)`

config / environment.rb:



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



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



编辑#3:我修正了它!这听起来像是有一些复杂的依赖性问题。遵循以下建议: http://docs.heroku.com/rails236 升级到rails 2.3 .8似乎已经解决了这个问题。 脚本/控制台现在正确启动。 code> ./ script / console --trace 或 rake db:migrate --trace ,rake命令可能会失败,但 - 跟踪开关可以为您的应用失败提供有价值的信息。


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/ruby/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.

这篇关于脚本/控制台不起作用;报道“缺少Rails宝石。请`gem install -v = rails` ..."即使轨道显示为已安装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆