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

时间:2022-10-07 00:24:08

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

我试图生成一个控制器,但它给了我这个错误。我在我的文件中找不到是什么原因导致了这个错误,所以非常感谢您的帮助。我正在运行Ruby '2.0.0'和rails '4.2.0。如果有帮助的话。请帮助!谢谢

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>'

1 个解决方案

#1


14  

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宝石,无法找到:

`require': cannot load such file -- pty

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:

原因是pty gem在Windows上不可用。希望在Rails 4.2发布之前解决这个问题。现在,您可以通过删除Gemfile中的web控制台gem来解决这个问题:

# Gemfile
# gem 'web-console'

Run bundle install after removing that gem.

在删除该gem之后运行bundle安装。


To fix the problem that no source of timezone data could be found (TZinfo::DataSourceNotFound) please add the following line to your Gemfile:

要解决无法找到时区数据来源的问题(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

#1


14  

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宝石,无法找到:

`require': cannot load such file -- pty

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:

原因是pty gem在Windows上不可用。希望在Rails 4.2发布之前解决这个问题。现在,您可以通过删除Gemfile中的web控制台gem来解决这个问题:

# Gemfile
# gem 'web-console'

Run bundle install after removing that gem.

在删除该gem之后运行bundle安装。


To fix the problem that no source of timezone data could be found (TZinfo::DataSourceNotFound) please add the following line to your Gemfile:

要解决无法找到时区数据来源的问题(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