Rails生成控制器给我加载错误

时间:2014-10-31 02:32:45

标签: ruby-on-rails ruby ruby-on-rails-4 command-prompt

我尝试生成一个控制器,但它给了我这个错误。我无法在文件中找到导致此错误的位置,因此非常感谢您的帮助。我正在运行Ruby' 2.0.0'和rails&#;; 4.2.0.beta2'如果这有帮助的话。请帮忙!感谢

我不明白为什么这篇文章被标记为重复。我的问题与其他问题无关。另外,我想知道如何解决这个问题,据我所知,我甚至没有看到修复错误的方法。请帮助!

c:\Users\NAME\workspace\sample_app>rails generate controller StaticPages home help

DL is deprecated, please use Fiddle
C:/Ruby200/lib/ruby/gems/2.0.0/gems/web-console-2.0.0.beta3/lib/web_console/slave.rb:1:in
`require': cannot load such file -- pty (LoadError)
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/web-console-2.0.0.beta3/lib/web_console/s
lave.rb:1:in `<top (required)>'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/web-console-2.0.0.beta3/lib/web_console.r
b:13:in `require'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/web-console-2.0.0.beta3/lib/web_console.r
b:13:in `<top (required)>'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/web-console-2.0.0.beta3/lib/web-console.r
b:1:in `require'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/web-console-2.0.0.beta3/lib/web-console.r
b:1:in `<top (required)>'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.7.3/lib/bundler/runtime.rb:76:i
n `require'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.7.3/lib/bundler.rb:133:in `requ
ire'
from c:/Users/Devin Miller/workspace/sample_app/config/application.rb:7:in `<top (
required)>'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/railties-4.2.0.beta2/lib/rails/commands/c
ommands_tasks.rb:141:in `require'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/railties-4.2.0.beta2/lib/rails/commands/c
ommands_tasks.rb:141:in `require_application_and_environment!'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/railties-4.2.0.beta2/lib/rails/commands/c
ommands_tasks.rb:128:in `generate_or_destroy'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/railties-4.2.0.beta2/lib/rails/commands/c
ommands_tasks.rb:50:in `generate'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/railties-4.2.0.beta2/lib/rails/commands/c
ommands_tasks.rb:39:in `run_command!'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/railties-4.2.0.beta2/lib/rails/commands.r
b:17:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'

1 个答案:

答案 0 :(得分:14)

问题是Rails 4.2.0.beta取决于pty gem而无法找到它:

`require': cannot load such file -- pty

原因是Windows上没有pty gem。希望在Rails 4.2发布之前得到修复。目前,您可以通过从web-console

中移除Gemfile gem来解决此问题
# Gemfile
# gem 'web-console'

删除该gem后运行bundle install


要解决no source of timezone data could be found (TZinfo::DataSourceNotFound)问题,请将以下行添加到Gemfile

gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw]

然后再试一次:

bundle install
bundle exec rails generate controller StaticPages home help