2017-09-24 121 views
0

我一直在跟着一個Rails應用程序的教程。本教程基於Rails 5,我正在使用Rails 5.1.2。一切都在本地很好,並推向英雄沒有問題。然而,當我去運行,以創建生產數據庫管理員用戶:如何在Heroku中運行rails控制檯? Rails 5.1和postgresql

​​3210

它返回以下錯誤:

/app/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.3/lib/active_support/dependencies.rb:292:in require': cannot load such file -- rack/handler/c (LoadError) from /app/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.3/lib/active_support/dependencies.rb:292:in block in require' from /app/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.3/lib/active_support/dependencies.rb:258:in load_dependency' from /app/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.3/lib/active_support/dependencies.rb:292:in require' from /app/vendor/bundle/ruby/2.4.0/gems/rack-2.0.3/lib/rack/handler.rb:74:in try_require' from /app/vendor/bundle/ruby/2.4.0/gems/rack-2.0.3/lib/rack/handler.rb:16:in get' from /app/vendor/bundle/ruby/2.4.0/gems/rack-2.0.3/lib/rack/server.rb:301:in server' from /app/vendor/bundle/ruby/2.4.0/gems/railties-5.1.3/lib/rails/commands/server/server_command.rb:68:in print_boot_information' from /app/vendor/bundle/ruby/2.4.0/gems/railties-5.1.3/lib/rails/commands/server/server_command.rb:38:in start' from /app/vendor/bundle/ruby/2.4.0/gems/railties-5.1.3/lib/rails/commands/server/server_command.rb:131:in block in perform' from /app/vendor/bundle/ruby/2.4.0/gems/railties-5.1.3/lib/rails/commands/server/server_command.rb:126:in tap' from /app/vendor/bundle/ruby/2.4.0/gems/railties-5.1.3/lib/rails/commands/server/server_command.rb:126:in perform' from /app/vendor/bundle/ruby/2.4.0/gems/thor-0.20.0/lib/thor/command.rb:27:in run' from /app/vendor/bundle/ruby/2.4.0/gems/thor-0.20.0/lib/thor/invocation.rb:126:in invoke_command' from /app/vendor/bundle/ruby/2.4.0/gems/thor-0.20.0/lib/thor.rb:387:in dispatch' from /app/vendor/bundle/ruby/2.4.0/gems/railties-5.1.3/lib/rails/command/base.rb:63:in perform' from /app/vendor/bundle/ruby/2.4.0/gems/railties-5.1.3/lib/rails/command.rb:44:in invoke' from /app/vendor/bundle/ruby/2.4.0/gems/railties-5.1.3/lib/rails/commands.rb:16:in ' from bin/rails:9:in require' from bin/rails:9:in '`

爲了解決這個問題,我可以運行:

$ heroku run bash 
$ rails c 

這使我可以更新生產數據庫。雖然這工作,並得到我所需要的。我想知道爲什麼原始命令不起作用。我到處尋找答案,不能拿出任何適用於我的東西。我正在努力提高自己的開發技能,並希望理解爲什麼原始問題不起作用。

我可以添加任何人需要查看的文件,但我甚至不知道哪個文件與這個問題有關。

+0

你張貼整個錯誤消息? –

+0

https://devcenter.heroku.com/articles/getting-started-with-rails5#rails-console指出'heroku run rails console'是在heroku上訪問您的rails控制檯的正確命令。根據其他stackoverflow文章,這可能是缺少的寶石或環境參數,找不到。 –

回答

0

我的理解是,heroku run命令由Heroku命令行界面(CLI)提供。 CLI不知道如何處理rails c命令。然而,運行heroku run bash將啓動一個新的dyno並提供對Unix shell的訪問,在那裏你可以運行命令(即rails c),就像你是本地終端一樣。欲瞭解更多信息,請參閱:https://devcenter.heroku.com/articles/how-heroku-works

編輯,以修復錯誤:在CLI不知道如何處理的rails c命令

+0

這是一件新事物嗎?當我們說話時,我實際上正在看着他跑命令'heroku run rails c'。我知道rails 5和5.1之間有一些非常大的變化,而且heroku本身已經更新。我會通讀你的鏈接,並將它標記爲回答,如果它談論這一點,雖然。感謝 –

+0

我回顧了Rails特有的Heroku文檔,它似乎支持命令。也許嘗試發佈一個鏈接到存儲庫? – lgants

相關問題