【发布时间】:2017-02-06 17:39:45
【问题描述】:
我在生产中无法访问 rails 控制台。
我使用Capistrano将应用部署到 VPS
如果我 cd 到 deploy@myapp:~/myapp/current$ 并运行 bundle exec rails cthere,我总是会得到用于创建新 Rails 项目的选项列表,例如 rails new
我也试过bundle exec rails console --production和rails consoleetc,结果都一样。
问题是我必须能够访问控制台,因为我必须为 active admin 创建一个管理员用户
可能值得补充的是,我在 Ubuntu 16 上使用Passenger/Capistrano 和 Nginx
有人知道这里发生了什么吗?我做错了吗?
*编辑
运行RAILS_ENV=production bundle exec rails c 后我收到此消息
Looks like your app's ./bin/rails is a stub that was generated by Bundler.
In Rails 4, 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
rake rails:update:bin # Use the new Rails 4 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
Loading production environment (Rails 4.2.5)
irb(main):001:0>
【问题讨论】:
-
您有
~/myapp/current/bin文件夹吗?它是否包含rails? -
是的,它在里面,但它似乎是空的......至少如果我
ls进入它 -
是的,它应该有可执行文件。检查你的 Github repo,它是否包含所有带有
bin的可执行文件。 -
我查了一下,Github repo 里面全是文件
-
RAILS_ENV=production bundle exec rails c- 它显示的是哪个错误?
标签: ruby-on-rails ruby capistrano rails-console