【问题标题】:How can I restore my Rails 5 binstubs?如何恢复我的 Rails 5 binstubs?
【发布时间】:2016-11-23 04:37:16
【问题描述】:

我在 macOS Sierra 上使用 Rails 5 应用程序,一切都进行得很顺利,直到我准备好在 Digital Ocean VPS 上进行生产。我使用 Capistrano 关注了最著名的Deploy Rails app tutorial 之一,经过一些错误之后,我的应用终于在生产环境中运行了。

现在在我的 本地环境中,当我运行 rails serverrails 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

我一直在寻找这个错误是什么以及如何修复它,但我没有运气!作为参考,它似乎与Capistrano 相关,但我已经完成了他们所说的解决方案,但它不起作用,或者我没有以正确的方式实现它:

解决办法是:

1.- 从linked_dirs 中删除bin (这不是我的情况)

2.- 将 set :bundle_binstubs, nil 添加到您的 config/deploy.rb 以生成 binstubs

我找到的一些文章:

  1. https://github.com/capistrano/rails/issues/171
  2. https://github.com/capistrano/capistrano/issues/1675
  3. Rails 5 console not working when deploying with Capistrano
  4. https://github.com/capistrano/bundler/issues/45

非常感谢您能为我提供的任何帮助。 提前致谢。

【问题讨论】:

    标签: bundle ruby-on-rails-5 capistrano3 bin rvm-capistrano


    【解决方案1】:

    我知道这有点晚了,但我发现我可以运行 $ rails app:update 并且它会恢复/覆盖我的 binstubs... 以及覆盖你开始使用的所有其他配置文件。所以要小心。

    有关此任务的更多信息,请参阅Upgrading Ruby on Rails 指南。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-02-01
      • 2022-11-02
      相关资源
      最近更新 更多