我正在尝试学习RoR,并且运行脚本/控制台失败,返回:
加载开发环境(Rails 2.3.5)
缺少Rails宝石。请gem install -v= rails
,更新您已安装的Rails版本的config / environment.rb中的RAILS_GEM_VERSION设置,或注释掉RAILS_GEM_VERSION以使用安装的最新版本。
gem list
和sudo gem list
都显示已安装的rails(2.3.5)。此外,脚本/服务器工作正常。我发现一些消息来源表明问题可能是机架(1.1.0),所以我恢复到1.0.1,但它没有帮助。
我很喜欢你们的任何建议,因为我真的想学习RoR,即使是迄今为止我见过的短暂内容。
编辑:@ zed_0xff:
好的,这是./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
这是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
这有帮助吗?
编辑#2:@ zed_0xff:
rake gems
:
`(在/ home / carpdiem / Dropbox / programming / ruby / rails_projects / demo_app中)
我=已安装 F =冻结 R = Framework(在rails开始之前加载)`
配置/ environment.rb中:
`需要File.join(File.dirname(文件),'boot')
Rails :: Initializer.run do | config | config.time_zone ='UTC' end`
编辑#3:我修好了!听起来有些复杂的依赖问题是错误的。按照此处的建议:http://docs.heroku.com/rails236升级到rails 2.3.8似乎解决了这个问题。script/console
现在正确启动。
答案 0 :(得分:1)
尝试运行./script/console --trace
或rake db:migrate --trace
,rake命令也可能会失败,但--trace
切换可以为您提供有关应用失败的重要信息。