我正在爲macOS Sierra上的Rails 5應用程序工作,一切進展順利,直到我準備好生產Digital Ocean VPS。我跟着其中一個最着名的Deploy Rails app tutorial使用Capistrano,我經過一些錯誤終於實現了我的應用程序生產運行。如何恢復我的Rails 5 binstubs?
或現在在我的當地環境當我運行rails server
rails console
我得到這個警告,我不知道如何解決它或什麼與怎麼了?。
Looks like your app's ./bin/rails is a stub that was generated by Bundler.
In Rails 5, your app's bin/ directory contains executables that are versioned
like any other source code, rather than stubs that are generated on demand.
Here's how to upgrade:
bundle config --delete bin # Turn off Bundler's stub generator
rails app:update:bin # Use the new Rails 5 executables
git add bin # Add bin/ to source control
You may need to remove bin/ from your .gitignore as well.
When you install a gem whose executable you want to use in your app,
generate it and add it to source control:
bundle binstubs some-gem-name
git add bin/new-executable
=> Booting Puma
=> Rails 5.0.0.1 application starting in development on http://localhost:3000
=> Run `rails server -h` for more startup options
Puma starting in single mode...
* Version 3.6.0 (ruby 2.3.1-p112), codename: Sleepy Sunday Serenity
* Min threads: 5, max threads: 5
* Environment: development
* Listening on tcp://localhost:3000
Use Ctrl-C to stop
我一直在尋找這個bug以及如何解決它,但我沒有運氣!而對於參考它似乎是一些與Capistrano
,但我已經做了,他們說的是解決方案,它不工作,也許我還沒有實現它的正確方法:
篇的解決辦法是:
1.-從
linked_dirs
刪除bin
(這是不是我的情況)2:添加
set :bundle_binstubs, nil
您config/deploy.rb
生成binstubs
一些文章,我發現:
- https://github.com/capistrano/rails/issues/171
- https://github.com/capistrano/capistrano/issues/1675
- Rails 5 console not working when deploying with Capistrano
- https://github.com/capistrano/bundler/issues/45
我真的很感激任何類型的幫助,你能提供給我。 在此先感謝。