gpt4 book ai didi

ruby-on-rails - `rails s` 表示 "` 在 Windows RailsInstaller 中需要 ': cannot load such file -- pty (LoadError)"

转载 作者:数据小太阳 更新时间:2023-10-29 09:00:54 26 4
gpt4 key购买 nike

我刚刚在我的 Windows 10 PC 上安装了 RailsInstaller。我无法运行 rails srails g controller StaticPages home help

我还尝试按照 this 的建议安装 zeus gem 来解决这个问题相关的 StackOverflow 问题,但没有成功。

gem 文件:

source 'https://rubygems.org'

gem 'rails', '4.2.2'
gem 'sass-rails', '5.0.2'
gem 'uglifier', '2.5.3'
gem 'coffee-rails', '4.1.0'
gem 'jquery-rails', '4.0.3'
gem 'turbolinks', '2.3.0'
gem 'jbuilder', '2.2.3'
gem 'sdoc', '0.4.0', group: :doc
gem 'pry-nav', group: [:development, :test]

group :development, :test do
gem 'sqlite3', '>= 1.3.9'
gem 'byebug', '3.4.0'
gem 'web-console', '2.0.0.beta3'
gem 'spring', '1.1.3'
end

group :test do
gem 'minitest-reporters', '1.0.5'
gem 'mini_backtrace', '0.1.3'
gem 'guard-minitest', '2.3.1'
end

group :production do
gem 'pg', '0.17.1'
gem 'rails_12factor', '0.0.2'
end

错误:

rails s
c:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.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.2.0/lib/ruby/gems/2.2.0/gems/web-console-2.0.0.beta3/lib/web_console/slave.rb:1:in `<top (required)>'
from c:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/web-console-2.0.0.beta3/lib/web_console.rb:13:in `require'
from c:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/web-console-2.0.0.beta3/lib/web_console.rb:13:in `<top (required)>'
from c:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/web-console-2.0.0.beta3/lib/web-console.rb:1:in `require'
from c:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/web-console-2.0.0.beta3/lib/web-console.rb:1:in `<top (required)>'
from c:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:77:in `require'
from c:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:77:in `block (2 levels) in require'
from c:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:72:in `each'
from c:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:72:in `block in require'
from c:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:61:in `each'
from c:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:61:in `require'
from c:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.11.2/lib/bundler.rb:99:in `require'
from c:/Sites/sample_app/config/application.rb:7:in `<top (required)>'
from c:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/railties-4.2.2/lib/rails/commands/commands_tasks.rb:78:in `require'
from c:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/railties-4.2.2/lib/rails/commands/commands_tasks.rb:78:in `block in server'
from c:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/railties-4.2.2/lib/rails/commands/commands_tasks.rb:75:in `tap'
from c:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/railties-4.2.2/lib/rails/commands/commands_tasks.rb:75:in `server'
from c:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/railties-4.2.2/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from c:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.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>'

最佳答案

回溯告诉我们网络控制台 gem 需要 Ruby 的 pty 库。遗憾PTYs (pseudo-terminals)是 Windows 上不存在的 Unix/Linux 功能,因此 Ruby 库也不存在。

您可以通过多种方式开始行动:

  • 如果您现在不关心网络控制台 gem,只需将其从 Gemfile 中删除即可。

  • 如果您真的需要 web-console gem,请尝试用这些 gem 替换 web-console:

    gem 'rubysl-pty', platforms: :ruby
    gem 'web-console-rails3', platforms: :ruby

    来源:a web-console Github issue .

关于ruby-on-rails - `rails s` 表示 "` 在 Windows RailsInstaller 中需要 ': cannot load such file -- pty (LoadError)",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35963574/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com