Rails 生成控制器给我加载错误 [英] Rails Generate Controller gives me load error

查看:29
本文介绍了Rails 生成控制器给我加载错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试生成一个控制器,但它给了我这个错误.我无法在我的文件中找到导致此错误的原因,因此非常感谢您的帮助.如果有帮助的话,我正在运行 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:UsersNAMEworkspacesample_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 中删除 web-console gem 来解决此问题:

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 后运行 bundle install.

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 生成控制器给我加载错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆