问题描述
我尝试生成一个控制器,但是它给了我这个错误。我找不到文件中导致此错误的原因,因此非常感谢您的帮助。如果有帮助,我将运行Ruby'2.0.0'和rails'4.2.0.beta2'。请帮忙!谢谢
I try to generate a controller but it gives me this error. I can't find where in my files what caused this error so help would be much appreciated. I am running Ruby '2.0.0' and rails '4.2.0.beta2' if that helps at all. PLEASE help! Thanks
我不理解为什么这篇文章被标记为重复。我的问题与其他问题无关。另外,我要问该怎么做才能解决它,据我所读,我什至没有看到该错误的解决方法。
I don't undestand WHY this post is getting marked as a duplicate. My question has nothing to do with that other question. Plus, I am asking what to do to fix it, and as far as I read, I didn't even see a fix to that error. PLEASE HELP!
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>'
推荐答案
问题在于Rails 4.2.0.beta取决于 pty
gem,无法找到它:
The problems is the Rails 4.2.0.beta depends on the pty
gem and is unable to find it:
`require': cannot load such file -- pty
原因是 pty
gem在Windows上不可用。希望在Rails 4.2发布之前可以解决此问题。目前,您可以通过从 Gemfile
:
The reason is that the pty
gem is not available on Windows. Hopefully that gets fixed before Rails 4.2 is released. At the moment you can fix this problem by removing the web-console
gem from your Gemfile
:
# Gemfile
# gem 'web-console'
在删除该gem后运行捆绑安装
。
Run bundle install
after removing that gem.
要解决以下问题:找不到时区数据源(TZinfo :: DataSourceNotFound)
,请将以下行添加到您的 Gemfile
:
To fix the problem that no source of timezone data could be found (TZinfo::DataSourceNotFound)
please add the following line to your Gemfile
:
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw]
然后重试:
bundle install
bundle exec rails generate controller StaticPages home help
这篇关于Rails Generate Controller给我加载错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!