2

我剛纔在我的Windows 10的電腦上安裝RailsInstaller。我不能夠運行rails srails g controller StaticPages home help`軌s`說: 「'需要':無法加載這樣的文件 - PTY(LoadError)」 在Windows RailsInstaller

我也試圖通過安裝宙斯寶石由this相關的StackOverflow問題的建議,但沒有成功解決這一問題。

的Gemfile:

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

回答

1

回溯告訴我們,Web的控制檯寶石希望Ruby的PTY庫。不幸的是PTYs (pseudo-terminals)是在Unix/Linux的功能,它不存在於Windows,從而使Ruby庫確實沒有。

可以得到移動在幾個方面:

  • 如果你不關心Web的控制檯的寶石,現在,只是從你的Gemfile中刪除它。

  • 如果你真的需要Web的控制檯寶石,嘗試用這些寶石替換Web的控制檯:

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

    來源:a web-console Github issue

+0

我已刪除了Web控制檯。現在我有另一個錯誤。我應該更新這個問題還是提出新的問題? 'c:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/tzinfo-1.2.2/lib/tzinfo/data_source.rb:182:in'rescue in create_default_data_source':No source of時區數據可以找到。 (TZInfo :: DataSourceNotFound)' – AbhimanyuAryan

+0

我會用一個單獨的問題去了。 –

1

我按照以下步驟解決此問題:

  1. 首先檢查你的Gemfile.lock的,如果你已經在那裏提到bcrypt版本,那麼你就不需要提的Gemfile的bcrypt版本。
  2. 如果bcrypt版本中缺少Gemfile.lock的,然後在執行下列步驟: 一)創業板安裝bcrypt B)打開你的Gemfile和粘貼「寶石‘bcrypt’,‘〜> 3.1.7’」 Ç )在控制檯運行命令:捆綁安裝

我希望通過以下給出的步驟可能會解決您的問題。

相關問題