rails 生成脚手架用户名:字符串电子邮件:字符串
Posted
技术标签:
【中文标题】rails 生成脚手架用户名:字符串电子邮件:字符串【英文标题】:rails generate scaffold User name:string email:string 【发布时间】:2015-11-02 23:37:18 【问题描述】:在我必须编写的第 2.2 节中的 https://www.railstutorial.org/book/toy_app 教程中:$ rails generate scaffold User name:string email:string
时,我遇到了一些错误:
c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/web-console-2.0.0.beta3/lib/web_console/slave.rb:1:in `require': cannot load such file -- pty (LoadError)
from c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/web-console-2.0.0.beta3/lib/web_console/slave.rb:1:in `<top (required)>'
from c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/web-console-2.0.0.beta3/lib/web_console.rb:13:in `require'
from c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/web-console-2.0.0.beta3/lib/web_console.rb:13:in `<top (required)>'
from c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/web-console-2.0.0.beta3/lib/web-console.rb:1:in `require'
from c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/web-console-2.0.0.beta3/lib/web-console.rb:1:in `<top (required)>'
from c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/bundler-1.10.6/lib/bundler/runtime.rb:76:in `require'
from c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/bundler-1.10.6/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
from c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/bundler-1.10.6/lib/bundler/runtime.rb:72:in `each'
from c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/bundler-1.10.6/lib/bundler/runtime.rb:72:in `block in require'
from c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/bundler-1.10.6/lib/bundler/runtime.rb:61:in `each'
from c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/bundler-1.10.6/lib/bundler/runtime.rb:61:in `require'
from c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/bundler-1.10.6/lib/bundler.rb:134:in `require'
from c:/Users/User/desktop/web/workspace/toy_app/config/application.rb:7:in `<top (required)>'
from c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.2.2/lib/rails/commands/commands_tasks.rb:141:in `require'
from c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.2.2/lib/rails/commands/commands_tasks.rb:141:in `require_application_and_environment!'
from c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.2.2/lib/rails/commands/commands_tasks.rb:128:in `generate_or_destroy'
from c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.2.2/lib/rails/commands/commands_tasks.rb:50:in `generate'
from c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.2.2/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.2.2/lib/rails/commands.rb:17:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
有什么建议吗?一整天都在烦我
【问题讨论】:
【参考方案1】:问题是 Rails 4.2.0beta 及更高版本依赖于 pty
gem,无法找到它。
`require': cannot load such file -- pty (LoadError)
这是因为此 gem 在 Windows 上尚不可用。对于临时修复,您可以从 Gemfile
中删除 web-console
gem,并在删除该 gem 后运行 bundle install
。
【讨论】:
以上是关于rails 生成脚手架用户名:字符串电子邮件:字符串的主要内容,如果未能解决你的问题,请参考以下文章
Ran 代码生成器:rails 生成脚手架帖子标题:字符串正文:文本并收到错误消息