简体   繁体   English

Rails Generate Controller给我加载错误

[英]Rails Generate Controller gives me load error

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. 如果有帮助的话,我正在运行Ruby'2.0.0'和rails'4.2.0.beta2'。 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>'

The problems is the Rails 4.2.0.beta depends on the pty gem and is unable to find it: 问题在于Rails 4.2.0.beta依赖于pty gem,无法找到它:

`require': cannot load such file -- pty

The reason is that the pty gem is not available on Windows. 原因是pty gem在Windows上不可用。 Hopefully that gets fixed before Rails 4.2 is released. 希望在Rails 4.2发布之前可以解决此问题。 At the moment you can fix this problem by removing the web-console gem from your Gemfile : 目前,您可以通过从Gemfile删除web-console gem来解决此问题:

# Gemfile
# gem 'web-console'

Run bundle install after removing that gem. 删除该gem后,运行bundle install


To fix the problem that no source of timezone data could be found (TZinfo::DataSourceNotFound) please add the following line to your Gemfile : 要解决no source of timezone data could be found (TZinfo::DataSourceNotFound)请将以下行添加到您的Gemfile

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

And then try again: 然后再试一次:

bundle install
bundle exec rails generate controller StaticPages home help

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM